The Lillster Posted August 23, 2008 Share Posted August 23, 2008 I'm currently making a new website and i'm designing it using css. But I can't seem to get my head around how this # thing works... Example What's the different between. div#header {background-image:url(images/top_grad.jpg); background-repeat:repeat-x; } And #header { background-image:url(images/top_grad.jpg); background-repeat:repeat-x; } As you can see the 1st one has the div before the # but the 2nd one doesn't. My question is, does it matter if the div part is there or not, or is it just there to make things more understandable? Link to comment Share on other sites More sharing options...
Shorty Posted August 23, 2008 Share Posted August 23, 2008 If you put div#header then <div id="header"> will have the header style but <span id="header"> (or anything else) will not. Whereas if you just use #header on its own, anything that you give the header ID to will get that style attribute. Link to comment Share on other sites More sharing options...
The Lillster Posted August 24, 2008 Author Share Posted August 24, 2008 Cheers. Thanks for that. Link to comment Share on other sites More sharing options...
Recommended Posts