The 'id' is used when the style to be applied is unique, .i.e., occurs once in the whole of the program code.
The above code occurs only once in the site code, So we use 'id' named 'footer'. The style will be defined in a file named style.css and stored in css directory at the root. Here 'a' defines the link text colour.Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> Learning CSS : id</TITLE> <link rel="stylesheet" href="css/style.css" type="text/css" media="screen,projection"> </HEAD> <BODY> <div id="footer"> Copyright © 2009 BizHat.com. All Rights Reserved<BR> Designed and Hosted by <a href="http://www.flashwebhost.com" target="blank"> FlashWebHost.com</A> </div> </BODY> </HTML>
css/style.css
Code:a { color:#FFFFFF; } #footer { font-family: verdana; font-size:10pt; width:850px; margin:0 0 0 0; background:#3366CC; color:#FFFFFF; text-align:center; padding-top:10px; padding-bottom:10px; }




Reply With Quote

Bookmarks