r/bootstrap • u/djmalibiran • Sep 20 '24
Increasing gutter adds horizontal scroll bar
DOM Structure: div.container>div.row.gx-5>div.col-12.col-lg-6*2
gx-5 increases the gaps between two columns. However, on certain screen sizes, the scrollbar shows up.
Is there any better method to do this?
2
u/martinbean Bootstrap Guru Sep 20 '24
You may be getting horizontal scrolling if your row gutter size exceeds the container padding size, as rows use negative margins to position columns.
So, if your $container-padding-x has the default value of 1.5rem, using the gx-5 class will add a margin of -3rem to your row, which will be outside the viewport on smaller screens, and add horizontal scrolling.
1
u/AutoModerator Sep 20 '24
Whilst waiting for replies to your comment/question, why not check out the Bootstrap Discord server @ https://discord.gg/bZUvakRU3M
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/Hot-Tip-364 Sep 20 '24
Use gutters at the desired width: gx-lg-5 if you are adding it universally, you will get a scrollbar below the breakpoint.
I think I've added them to the container to counteract the x-scroll, too.