0
I have 3 <div>
and they use the same class, I just want to stick the last margin.
I’ve tried to:
.classe:last {
margin-bottom: 0px;
}
0
I have 3 <div>
and they use the same class, I just want to stick the last margin.
I’ve tried to:
.classe:last {
margin-bottom: 0px;
}
0
You can use
.class:last-child { margin-bottom:0px }
However in this case any last elmento will apply the style
To ensure that the element is only the div use the following code
.class div:last-of-type{ margin-bottom:0px }
.class div {
margin-bottom:10px;
background:pink;
float:left;
width:100%;
}
.class div:last-of-type{
margin-bottom:0px;
}
<div class='class'>
<div>a</div>
<div>b</div>
<div>c</div>
ok texto
</div>
Browser other questions tagged css
You are not signed in. Login or sign up in order to post.
Use the pseudo-class :last-Child. Ex:
.classe:last-child { margin-bottom: 0px }
– Valdeir Psr