Hey everyone, Im using wordpress 1st off, Im still new-ish to CSS no formal bg in programing... Anyhow, my problem is getting multiple h2 styles on the same page. I have ".entry h2' and ".pages h2, h2.page_header" I want to add another h2 style to another div on that same page but all it does it takes on the style of .entry h2 even tho it shows in firebug as being pulled from ".entry .split h2" What am I doing wrong? Whats the correct way this should be written? Here is the basic flow I'm pulling from firebug - .entry .split h2 {style.css (line 564) } .entry .split h2 {style.css (line 564) } .entry h2 {style.css (line 237) } .pages h2, h2.page_header {style.css (line 181) } .entry h2 {style.css (line 237) } .pages h2, h2.page_header {style.css (line 181) } h2 {style.css (line 116) } h1, h2, h3 {style.css (line 75) } THANKS!!!
To get two styles of h2, use something like this in your HTML: <h2 class="style1">Heading Style One</h2> <h2 class="style2">Heading Style Two</h2> Code (markup): And this in your CSS: h2.style1{ color:#0f0; } h2.style2{ color:#f00; } Code (markup):
... or alternatively, define different H2 styles depending on their containing div: #div1 h2 {color:red} #div2 h2 {color:blue} Code (markup): However, blueparukia's suggestion is usually the better way to go since it doesn't require you to keep track of multiple different definitions when your H2s could appear in lots of differently named divs. Jon
Ok so I did that, its still using the same style attributes from ".entry h2" Do I have to rewrite all the attributes from .entry h2 in "h2.style2" ? Is this what Im missing? Should I dummy down hy H2 tags at there simplest point and build up from there? Im trying to do this with out using multiple stylesheets as I would have done before.
You'll need to combine the above techniques-- use .entry h2.newclass { stuff; } Because your other h2's are being referenced by their parents,and another by class alone... so since the one you want new styles on seems to be inside some parent with the class of .entry then you'll need that to be more specific than the other h2's who are only being referred to by the parent: .entry h2 Hope that helps. Ah, somewhere on my main page I have a link to paul O'brien's How The Cascade Works article you might want to read... but it's in a long list of links at stommepoes.nl