How to insert CSS on your Website
by
There are three different ways you can include CSS on your website.
- Link to a .CSS file
- Write the CSS between the head elements of your web page
- Mix the CSS with the HTML by using the style attribute of the HTML tags
1 - Link to a .CSS file
<head> <link rel="stylesheet" type="text/css" href="cssFileName.css" /> </head>
2 - Write the CSS between the head elements of your web page
<head> <style type="text/css"> body {background-color: blue} h1 {color:white; font-size:12pt} p {margin-left: 10px} </style> </head>
3 - Mix the CSS with the HTML by using the style attribute of the HTML tags
<p style="margin-left: 10px"> This paragraph will have a 10 pixel margin on the left! </p>
Always test the results of changes to your CSS in as many browsers as you can! I find I get the least frustrated when I get the CSS working as desired in Firefox first, then test to see if it works in Internet Exlporer. Often it will! However, when I get my CSS to work with Internet Explorer first, it rarely works in Firefox upon testing!
Did You Enjoy this Post? Subscribe to Web Dev Notes. It's Free!
September 20th, 2008 at 5:29 pm
solution proactiv canada proactiv reviews solution