Reputation: 455
I want to remove the border-right for the last child using css. I'm using the html below:
<div class="dividers">
<div class="clone_container">
<img src="clone.png"/>
<a class="button-link">Clone</a>
</div>
<div class="delete">
<img src="delete.png"/>
<a class="button-link">Delete</a>
</div>
<div class="abort">
<img src="abort.png"/>
<a class="button-link">Abort</a>
</div>
<div class="pause">
<img src="pause.png"/>
<a class="button-link">Pause</a>
</div>
</div> //end of dividers div
and the css:
div.dividers a {
display: inline-block;
border-right: 1px solid #DCDCDC;
border-radius: 4px;
height: 22px;
}
div.dividers {
margin-right: -3px;
padding-right: 0px
}
div.dividers a:last-child { border-right: none; }
when i do a { border-right: none; }
like shown above, all the borders are removed.
how can i fix this? anyone with any ideas??
The output i am looking for is: Clone | Delete | Abort | Pause
Upvotes: 2
Views: 13232
Reputation: 9065
You need to target last div in .dividers
div:
div.dividers div:last-child a {
border-right: none;
}
Upvotes: 3
Reputation: 288120
Try
div.dividers > div:last-child > a { border-right: none; }
Your code div.dividers a:last-child
means
<a>
such as
<div>
with class dividers
.The code div.dividers > div:last-child > a { border-right: none; }
means
<a>
such as
<div>
which
<div>
with class dividers
.Upvotes: 5