Hi I am trying to use the last-child operator to hide the last div which applies a border. My issue is that the las div still has the border on the bottom
Below is the HTML for my Test
<div class="car-search">
<!--other divs removed for example-->
<div class="border-bottom"></div>
</div>
<div class="car-search">
<!--other divs removed for example-->
<div class="border-bottom"></div>
</div>
The CSS
.car-search .border-bottom{
border-bottom: 1px solid $lighterGrey;
padding-top: 15px;
margin-bottom: 15px;
width: 770px;
margin-left: 15px;
}
.car-search:last-child .border-bottom{
display: none;
}
I have no idea why the border is being displayed on the last .car-search
Current Output:
.car-search .border-bottom {
border-bottom: 1px solid #000;
padding-top: 15px;
margin-bottom: 15px;
width: calc(100% - 30px);
margin-left: 15px;
}
.car-search:last-child .border-bottom {
display: none;
}
Attempts
I have also tried using the !important
tag with no success
I have tried :last-of-type
with no success