class+element over-riding class+class

69 Views Asked by At

OK I have the following code:

<div class="something">
    <div class="something-else">
        <h2>Heading</h2>
        <p>Some text</p>
    </div>
</div>

When I try to style it, a CSS rule in another style sheet won't let me do so. The other style sheet has something like:

.something h2 {
    color:green;
}

I'm trying to override it with:

.something .something-else {
    color:red;
}

Is the first rule more specific? Because I thought that two classes would win in this situation.

1

There are 1 best solutions below

0
On

2 classes + h2 will work for you

you have to select h2 in this case