Hi Tee Please use <div></div> tag in your coding. As your css is right but it's not effected till you didn't mention the parent :)
Example: <div> <h2>Heading 2 this is the first-child and the bg color should be in Olive.</h2> <h2>Another Heading 2 - this </h2> <p>This is paragraph and first-child so the bg color should be in Olive too.</p> <p>Another Heading 2 - this </p> </div> Let me know is it work or not. Regards Birendra -----Original Message----- From: li...@webstandardsgroup.org [mailto:li...@webstandardsgroup.org] On Behalf Of tee Sent: Sunday, March 06, 2011 3:34 PM To: wsg@webstandardsgroup.org Subject: [WSG] why :first-child pseudo-class doesn't work for some selectors/elements? http://jsbin.com/apate4/9/ dt, dd { border-top:1px solid #555;float:left } dt:first-child {border-top:0} dd:first-child {border-top:0} h2, p {background:#ddd;padding:15px;margin:5px} h2:first-child,p:first-child {background:#95B26B} p/s. I tried declared the two individually as I thought maybe they can't be grouped, but it makes no differences. According to the spec, it should work. The :first-child pseudo-class represents an element that is the first child of some other element. http://www.w3.org/TR/css3-selectors/#first-child-pseudo Assigning a class to the element is of no help. tee ******************************************************************* List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: memberh...@webstandardsgroup.org ******************************************************************* ******************************************************************* List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: memberh...@webstandardsgroup.org *******************************************************************