2

Cannot work this one out. My headers from h2 through to h4 are white in color instead of black. Everything seems to work is it should when removing color: white; from a class that isn't even being used on the page (but is in the stylesheet):

.right_content_default h1,h2,h3,h4,h5,h6 {
    color: white;
}

The only thing I can think of is a possible syntax issue, but I can't locate it in the stylesheet.

Here's the fiddle: jsfiddle

2
  • You might want to consider checking the syntax of your HTML too -- it has a few nesting issues. (They're not the cause of the problem in this case, though) Jan 1, 2013 at 21:11
  • That's probably because I quickly took a few chunks out of it for the jsfiddle, thanks
    – sooper
    Jan 1, 2013 at 21:14

2 Answers 2

8

Your selector is looking for "h1 inside .right_content_default, or any of h2, h3, h4, h5, h6". Nothing it telling it to only apply the white colour to headings inside that class name, other than h1.

The correct CSS is:

.right_content_default h1, .right_content_default h2, .right_content_default h3,
.right_content_default h4, .right_content_default h5, .right_content_default h6 {
    color:white
}

But in some browsers you can do this:

.right_content_default :matches(h1,h2,h3,h4,h5,h6) {color:white}
2
  • 1
    @Kolink don't abuse the code tag then, half the content you've shoved into the code tag isn't actually code.
    – cimmanon
    Jan 1, 2013 at 21:17
  • @sooper I'm not sure. It's CSS4, so I would guess Firefox and Chrome will adopt it in due time. Jan 1, 2013 at 21:34
8

try this:

      .right_content_default h1,
      .right_content_default h2,
      .right_content_default h3,
      .right_content_default h4,
      .right_content_default h5,
      .right_content_default h6 {
       color: white;
      }
1
  • +1 (and it's got the proper formatting of new lines for each! ) i think if you explained this just a bit, it would be a really great answer
    – d-_-b
    Jan 1, 2013 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.