Search:

Home | Programming | Html


How to insert CSS on your Website

By: Deceth

There are three different ways you can include CSS on your website.


  1. Link to a .CSS file

  2. Write the CSS between the head elements of your web page

  3. 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!

Article Source: http://www.writerdatabase.com

www.webdevnotes.com/how-to-insert-css-on-your-website/

Please Rate this Article

 

Not yet Rated

Click the XML Icon Above to Receive HTML Articles Via RSS!

Powered by Article Dashboard