Reputation:
HTML:
<div class="plan-box">
<h3>...</h3>
<p>...</p>
</div>
<div class="plan-box">
<h3>...</h3>
<p>...</p>
</div>
CSS:
.plan-box:last-of-type {
...
}
In the above CSS code if I use last-of-type
or last-child
css selector on .plan-box
will that select the last-child
in both the .plan-box
div which is the paragraph or will it select the second .plan-box
div in the HTML code?
Upvotes: 0
Views: 177
Reputation: 4382
.plan-box:last-child
Selects last of plan.box
element
.plan-box :last-child
Selects last elements in all of plan.box
elements
Upvotes: 1
Reputation: 2735
It will select second .plan-box
div
in the HTML code.
See the Link here
Again you can easily select any child div
with CSS .Example is Here
I have used here .plan-box:nth-child(2) {}
for select second div
.
Upvotes: 0