Welcome to WebmasterWorld Guest from 54.227.52.24

Forum Moderators: not2easy

Message Too Old, No Replies

Question about nesting css selectors syntax

     

nelsonm

3:22 pm on Jul 2, 2012 (gmt 0)

5+ Year Member



hi all,

when nesting css selectors, which of the following is the proper syntax...

are no spaces between nested selectors valid
div.class3, #id1#id2, .class1#id3, #id4.class2 {}

or does there always have to be a space between nested selectors...
div .class3, .class4 div, #id1 #id2, .class1 #id3, #id4 .class2 {}

lucy24

4:57 pm on Jul 2, 2012 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



div.class3
div .class3

mean different things. The first is

<div class = "class3">
blahblah
</div>

The second is

<div-of-any-kind>
<anything class = "class3">
blahblah
</anything>
</div>

ergophobe

4:59 pm on Jul 2, 2012 (gmt 0)

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



A space indicates that it is part of the cascade; no space does not

div.class3 refers to a div tag with a class attribute of "class3"

div .class3 should refer to a div tag that has a child of class3 and might be the same as, for example, div.class1 p.class3

nelsonm

6:25 pm on Jul 2, 2012 (gmt 0)

5+ Year Member



Ok thanks.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month