CSS: Where Little Things Mean a Lot - On to CSS
(Page 2 of 3 )
I can tell you want to get right to it and give the CSS stuff a go, so go ahead and make a file called ‘style.css’ and save it in the same folder as the HTML page you just made. Open it with a simple text editor, like Notepad, and add the following code:
body
{
background: #000000;
color: #FFFFFF;
text-align: center;
font-size: 20pt;
font-family: verdana, arial;
}
Save the file. Now add the following line in the HEAD tag of your HTML file:
<link href="style.css" type="text/css" rel="stylesheet" />
Now go and have a look at your web page again in your browser… a bit different isn’t it? Sure you could have done that with much less code by simply using <font> tags and <center> tags etc., but the main problem with this is that such tags are soon to be deprecated, and CSS is going to completely take over the way we do web design. Also, if you wish to have a ‘vaild’ (according to the W3C) site, you will have to use CSS and not rely on these <font> tags, etc. That’s just the reason why you almost have to do this, but you should be looking at doing this anyway, as when you make your next page, all you have to do is add one simple line:
<link href="style.css" type="text/css" rel="stylesheet" />
It will look exactly like your first page! You wont need to add all those <font> tags any more! And, the best part is that when you decide your site doesn’t look good with those colors or the chosen layout, all you have to change is the CSS file, as opposed to every HTML page you have created. Voila! Or Viola! Whichever it is, you’re done! Your entire site has a new, better and fresher look.
Next: CSS and the DIV Tag >>
More HTML Articles
More By Christopher Duell