CodTango
CodTango

Reputation: 355

Confused on the css name

css:

.a .b { position: relative; }
.c { position: relative; }

Then I though it would work the same way if I wrote it like this:

.a .b .c { position: relative; }

however, it doesn't, it has no effect about .c. So why it's not working when I put them together?

Upvotes: 1

Views: 77

Answers (1)

stackoverfloweth
stackoverfloweth

Reputation: 6917

what you want is

.a .b, .c { position: relative; }

.a .b .c expects this

<div class="a">
    <div class="b">
        <div class="c"></div>
    </div>
</div>

having a comma means .a .b OR .c

Upvotes: 5

Related Questions