Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto wrap with col does not work in Safari #21967

Closed
iFlash opened this issue Feb 11, 2017 · 11 comments
Closed

Auto wrap with col does not work in Safari #21967

iFlash opened this issue Feb 11, 2017 · 11 comments

Comments

@iFlash
Copy link

iFlash commented Feb 11, 2017

This code will not auto wrap in Safari 10.0.3 (OSX 10.12).

Basically using class="col" in order to auto wrap columns will not work. The columns are displayed outside page margins.

Chrome and FF behave as expected.

<div class="container-fluid">
    <div class="row">
        <div class="col"><small>Some text here</small></div>
        <div class="col"><small>Some text here</small></div>
        <div class="col"><small>Some text here</small></div>
        .... add more columns until they should wrap
        <div class="col"><small>Some text here</small></div>
        <div class="col"><small>Some text here</small></div>
    </div>
</div>
@iFlash
Copy link
Author

iFlash commented Feb 11, 2017

@mdo
Copy link
Member

mdo commented Feb 12, 2017

Bug reports must include a live demo of the problem. Per our contributing guidelines, please create a reduced test case via JS Bin and report back with specific browser and OS details.

@iFlash
Copy link
Author

iFlash commented Feb 12, 2017

I made an example available - see above. I don't have the time for more - sorry. I included the OS and the Browser in question in the first post.

@iFlash iFlash closed this as completed Feb 12, 2017
@iFlash iFlash reopened this Feb 13, 2017
@mukadr
Copy link

mukadr commented Mar 21, 2017

Created JSBin

Reproduced this issue on the following browsers:

iOS 7, Safari 7
iOS 8, Safari 8
iOS 7 & 8, Chrome 47

@mdo
Copy link
Member

mdo commented Mar 26, 2017

Turns out this is flexbug 11, where Safari doesn't wrap flex items properly. As I understand it, Safari uses different calculations for determining how to wrap flex items. The only workaround is using flex-basis to size the columns :. In this case, you'd need to add:

.col {
  flex: 1 0 50%; // where 50% is the intended size of the items
}

This is the same problem #21620 faces as well. Digging into even more, a border: 1px solid transparent on the .col will also fix this. Will work on a docs update to suggest these in context.

@dxh9845
Copy link

dxh9845 commented Jun 3, 2017

I got this as well. Site: danherzig.com. Happened on iOS browsers. Don't have an iPhone but got these screenshots. Fixed by reverting to prior columns (col-sm-12 and col-md-6). So the official fix was adding an invisible border?

@pimisi
Copy link

pimisi commented Mar 5, 2018

In my case I overrode the class .row:before, row:after, and set display: inline-block; That did the trick and did not affect Chrome and Firefox

@OndeVai
Copy link

OndeVai commented Mar 13, 2018

I'm on 4.0.0-beta.2 and am still seeing the problem on ios 8 safari. Will upgrading to the latest version of bootstrap 4 fix the problem or will I still need a workaround? If workaround needed, is it documented on the getbootstrap site?

@gigadie
Copy link

gigadie commented Jul 5, 2018

@pimisi suggestion wasn't working for me, but it worked changing it to display: block;

@mansouryaacoubi
Copy link

Here's the solution:
#9282 (comment)

Worked like a charm!

@zavr-1
Copy link

zavr-1 commented Jan 7, 2019

The border didn't work for me, it changed nothing on ios 10, and the explicit flex is too restrictive. What I've done is adding <div class="w-100" id="BugFix"></div> where I wanted the new line to be, and the following style to ensure it does not happen on wider viewports.

@media (min-width: 576px) {
  #BugFix {
    display: none;
  }
}

mikelehen added a commit to mikelehen/bootstrap that referenced this issue Feb 16, 2020
Reading the grid docs from top to bottom, this section made no sense to me. I didn't understand why you wouldn't just use multiple rows, and I had no idea what w-100 meant, or how you'd "mix" it with "responsive display utilities".

Then I continued reading and got to https://getbootstrap.com/docs/4.4/layout/grid/#column-breaks which explains the same concept but with a much better explanation and examples (including the responsive display utilities).

It looks like the "Equal-width multi-line" section was added in 9010978 to resolve to twbs#21967 as a way to document the existence of a Safari bug.  But that bug has long since been fixed (Safari 10.1 came out in May 2017) and so I think it's reasonable to just drop this section and rely on the better docs further down in the guide.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants