New to CSS, div#nav vs. #nav
Posted: 15 October 2008 11:59 PM   [ Ignore ]
Newbie
Rank
Total Posts:  2
Joined  2008-10-13

Hey guys, so I’m sure you can guess by the title of my post that I’m still very new to CSS. My question is, what is the difference between putting ‘div’ before ‘#example’ in your stylesheet versus putting ‘#example’. I think that if I were to give attributes to the ‘#example’ tag in my stylesheet, those attributes would coincide with ‘<div id=“example”...>’ in my HTML. If that is so, then what does putting ‘div’ before that same tag in the stylesheet refer to?

I know this question might be REAL basic but I was just trying to get some clarification.

Thanks!

Profile
 
 
Posted: 16 October 2008 06:09 AM   [ Ignore ]   [ # 1 ]
Member
Avatar
RankRankRank
Total Posts:  52
Joined  2007-11-08

when you put div#example in your stylesheet, it refers only to the div with id=“example” in your html markup.

If you rather put #example, it refers to any html element that has id=“example”

Profile
 
 
Posted: 19 October 2008 09:24 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  17
Joined  2008-10-19

the same goes for classes as well…


div.example would be the same as <div class=“example”>

Profile