3 ways to add CSS to your web sites

CSS to half of a character

Website can not be completed without any style. So you apply CSS. When a browser reads a CSS style sheet, this formats the HTML document according to the information in the CSS style sheet.

With 3 basic ways you can add CSS in your web pages:-

1) Link your webpage with an external file:

<link href="style.css" rel="stylesheet" type="text/css">

or import CSS:

 <style type="text/css" media="all">
 @import "../style.css";

Read Also: Align text vertically next to an image

2) Put the css between the <head> tags:

 <!DOCTYPE html>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <title>Sample page</title>
 <style type="text/css">
 div { padding-top: 10px; }

3) add CSS using inline:

 <div style="padding-top:10px;">Your content goes here...</div>

One thought on “3 ways to add CSS to your web sites”

Leave a Reply

Your email address will not be published. Required fields are marked *