Bootstrap 4 Change Spacing Between Columns Wraps Underneath Instead Of Side To Side
What I try to achieve is to have a 2 divs that take over 6 columns bith with some space between them of 1px. But for some reason when Ι try to achieveit, the other item goes unde
Solution 1:
The gutter (spacing between columns) is created with padding, not margins. When you adjust the margins it throws off the grid. You can use inner DIV's...
<divclass="container-fluid px-0"><divclass="row no-gutters"><divclass="col-6 text-light text-center"><divclass="bg-dark mr-1">Hello</div></div><divclass="col-6 text-light text-center"><divclass="bg-danger">Hello</div></div></div></div>
or, force the row
no to wrap with flex-nowrap
...
<divclass="container-fluid"><divclass="row flex-nowrap"><divclass="col-6 bg-dark text-light text-center mr-1"> Hello </div><divclass="col-6 bg-danger text-light text-center"> Hello </div></div></div>
or, simply use the padding utils to adjust the column spacing.
Solution 2:
<linkrel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"><scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script><scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script><divclass="container-fluid"><!-- Control the column width, and how they should appear on different devices --><divclass="row"><divclass="col-sm-6"style="background-color:yellow;">50%</div><divclass="col-sm-6"style="background-color:orange;">50%</div></div></div>
Post a Comment for "Bootstrap 4 Change Spacing Between Columns Wraps Underneath Instead Of Side To Side"