I am unable to get the columns to align next to each other. Instead, they are just stacked on top of each other.
.col-sm-4{
background-color: black;
opacity:0.9;
height: 100%;
margin: auto;
position: absolute
}
.container-fluid{
padding: 0;
}
.row{
margin: auto;
}
.col-sm-8{
background-color: darkred;
opacity: 0.9;
position: absolute;
text-align: right;
height: 100%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row">
<div class=" col-xs-2 col-sm-4 col-lg-2">
</div>
<div class="col-xs-10 col-sm-8 col-lg-10" >
</div>
</div>
</div>
2
Answers
just a quick note that Bootstrap 4 is a mobile-first design. So
col-xs-2
doesn’t work. Instead, usecol-2
which will apply it’s effect from0px
till the next breakpoint you make such ascol-sm-4
in your case.Also, you don’t need extra CSS you can just delete it. Remember that
col-xs
does not exist in bootstrap 4.Remove
position: absolute;
in the classes.col-sm-4
and.col-sm-4
and you’re done.Here you can see the result: https://jsfiddle.net/yz96fgje/