homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Question about nesting css selectors syntax

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

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 {}



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

div .class3

mean different things. The first is

<div class = "class3">

The second is

<anything class = "class3">


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

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


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

Ok thanks.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved