bulma icon indicating copy to clipboard operation
bulma copied to clipboard

BUG: columns.is-variable overflow

Open jimblue opened this issue 7 years ago • 19 comments

Overview of the problem

This is about the Bulma CSS framework I'm using Bulma version [0.6.1]

Description

columns with is-variable is bigger than parent container which cause an overflow. screen shot 2017-12-19 at 03 01 19 2

screen shot 2017-12-19 at 03 01 22 2

Expected behavior

This configuration shouldn't create an overflow.

jimblue avatar Dec 19 '17 02:12 jimblue

FIGURED IT OUT!

For anyone else experiencing this. Edit your .columns

It's going to have a left and right margin of "-0.75rem".

Remove those and the problem will be fixed.

ghost avatar Jan 03 '18 01:01 ghost

Thanks @mrbudlong23 !

That fix would probably need a review from @jgthms to be incorporated into Bulma.

jimblue avatar Jan 03 '18 08:01 jimblue

Hey @jgthms can we have your input on this?

jimblue avatar Apr 02 '18 22:04 jimblue

I am having this issue too. Removing the margins as described above works.... but WHY are those entries there in the first place? Presumably they have some kind of purpose....

wilchak avatar Apr 18 '18 22:04 wilchak

I would not recommend removing the margins from the columns class. They make it possible to push content to the end of the container, otherwise you will always have a padding of 0.75rem on both sides (or more/less if you have variable gaps or set a custom $column-gap). What worked for me is setting the css property overflow-x: hidden on the container class.

wdehaes avatar Apr 18 '18 23:04 wdehaes

A quick fix to this issue seems to be:

.columns { width: 100%; }

(and, if applicable, height: 100%;)

I have not tested this for other use cases than mine, but it did work. Please report back.

Gameghostify avatar May 16 '18 13:05 Gameghostify

Every fixes proposed here don't take is-mobile modifier into account. Please remember 100% width columns is not the only use-case here.

EDIT :

  • It only happens in Safari, (both safari desktop when resized under mobile breakpoint, and iphone)
  • It only happens when is-variable is > 6 (is-variable is-7, is-variable is-8, ...)
  • Because, over is-6, the .columns negative margin is larger the wrapping [section | hero-body | footer] and container

cyrilchapon avatar Jun 04 '18 07:06 cyrilchapon

Some points; it happens on Chrome in Responsive view as well, and on most mobile devices. It is not exclusive to .is-variable or .is-multiline.

The -.75rem margin is meant to offset a padding of .75rem of a columns container, however this is not being set anywhere. A fix would be to add a .has-columns class to a container which sets a padding of $column-gap to each side. This isn't needed when using nested columns however, so only use .has-columns on the outermost .columns container.

A pen: https://codepen.io/anon/pen/BVKJad

[edit] This breaks .is-gapless though, so don't use them together.

emkajeej avatar Jun 05 '18 07:06 emkajeej

I personally just overflow: hidden on the .columns' container, on mobile only

cyrilchapon avatar Jun 05 '18 15:06 cyrilchapon

Which is great until you actually need the overflow, e.g. when your columns contain box-shadows. :(

emkajeej avatar Jun 05 '18 15:06 emkajeej

Yes..

cyrilchapon avatar Jun 05 '18 15:06 cyrilchapon

any update on the fix @jgthms ?

PovilasSam avatar Jul 22 '18 18:07 PovilasSam

Summary This issue has been raised a bunch of times, likely causing it to seem less urgent as a single issue hasn't stood to rack up reactions from impacted devs. Here are all of the duplicates I could find, some of which are still open:

  • #1561
  • #2242
  • #776
  • #449
  • #766
  • #817
  • #2234
  • #931
  • #660

Bulma needs containers Bulma grids are similar to Bootstrap, using negative margins on rows (Bulma's .columns is equivalent to Bootstrap's .row). Because negative margins always cause side scroll, Bootstrap requires a .container wrapper around rows of columns, providing padding to absorb the negative margins.

@jgthms is there a reason not to do something like this in Bulma? is-marginless technically works, as you mentioned in #932, but it's a utility helper, and not really made for this. .columns will cause unwanted side scroll without a padded container, so it seems Bulma should include support so it works out of the box.

Bulma Docs is using a container Even the Bulma docs have to use non-Bulma CSS to work around this issue - there's a padded container. This bug can be reproduced in the Bulma docs like so:

  1. Go to https://bulma.io/documentation/columns/sizes/
  2. Reduce viewport width to less than 1024px (so the right sidebar is moved to the bottom)
  3. Disable two non-Bulma CSS rules:
  • overflow: hidden rule on the main.bd-main element
  • padding rule on .bd-lead
  1. The page can now be scrolled horizontally

Proposal Maybe a .grid class can be added to Bulma that does what .bd-lead does for the docs?

erquhart avatar Jul 18 '19 20:07 erquhart

I have added a .grid style (PR #2567) which may fix the issue when it gets merged in for anyone still looking

james-wasson avatar Jul 23 '19 21:07 james-wasson

This issue has been here forever, I can't remember a time I've used Bulma and didn't run into this.

Anyway, I managed to solve it by added is-gapless to the columns div.

It seems to have fixed the problem and hasn't caused any problems in my layout that I can see.

mforcer avatar Aug 12 '19 22:08 mforcer

Glad that works for you! But it's definitely a hack, and only works if you don't want gaps between any of your columns, which has been the exception rather than the rule in my experience.

erquhart avatar Aug 24 '19 18:08 erquhart

.columns {
  margin: 0;
}

AkioSarkiz avatar Apr 11 '20 21:04 AkioSarkiz

still actual

eclegend avatar Feb 02 '23 20:02 eclegend

Fix that worked for me:

.container {
	padding-inline: var(--bulma-column-gap); // .75rem
}

MichalSvatos avatar Aug 11 '24 16:08 MichalSvatos