What I want to do is remove the last child border from this column, but it doesn’t work. Here is the code:
.softdev-per{
margin-top: 3rem;
text-align: center;
font-size: 2.6rem;
padding-left: 2rem;
border-right: 2px solid $color-light-blue;
}
.softdev-per:nth-last-child(){
border-right: none;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-lg-3">
<div class="softdev-per">
<p>+<span>35</span>%</p>
<p>lead 1</p>
</div>
</div>
<div class="col-lg-3">
<div class="softdev-per">
<p>+<span>60</span>%</p>
<p>lead 2</p>
</div>
</div>
<div class="col-lg-3">
<div class="softdev-per">
<p>+<span>25</span>%</p>
<p>lead 3</p>
</div>
</div>
<div class="col-lg-3">
<div class="softdev-per">
<p>+<span>28</span>%</p>
<p>lead 4</p>
</div>
</div>
</div>
all I want to do is to remove the last child border-right but it doesn’t work.
2
Answers
i fixed the problem by adding a class inside column then select it with css with :nth-last-child(1) , and it worked .
like this :
:nth-last-child()
expects an expression inside parentheses, you’re most likely looking for just:last-child
From MDN
Comment from author:
it is because you need to set the last-child in
.col-lg-3
instead of.softdev-per
,something like this: