Reputation: 739
I have this HTML:
<div class="B">
blah
blah
blah
</div>
<section class="A">
<div class="B"/> <!-- THIS -->
<div/>
</section>
How can I target the div with the B class inside the section, and only it?
Upvotes: 1
Views: 58
Reputation: 14810
You can select it like this
.A>.B{
}
This is known as CSS element>element Selector
The syntax is as follows
element > element {
css declarations;
}
you can see an example here..
Upvotes: 1
Reputation: 4233
You should write :
section.A div.B {
}
If you want target just one element consider use id instead class.
Upvotes: 0