Skip to content

Add flow-root display utility #1247

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

Merged
merged 1 commit into from
Mar 18, 2020
Merged

Add flow-root display utility #1247

merged 1 commit into from
Mar 18, 2020

Conversation

benface
Copy link
Contributor

@benface benface commented Dec 3, 2019

The flow-root value for the display property is supported in all major browsers except iOS Safari and it's probably coming soon since it's already in macOS Safari. It's the most straightforward way to create a new block formatting context, which is notably useful to control/prevent margin collapsing (since margins only collapse within the same block formatting context).

@adamwathan
Copy link
Member

Hey! Going to wait to merge this until iOS Safari supports it since that's such a huge part of the internet, but will leave it open until then.

@benface
Copy link
Contributor Author

benface commented Jan 3, 2020

@adamwathan Actually, my bad, it is supported in iOS Safari as of iOS 13. For some reason Can I Use is wrong about this (I've submitted a report to correct it), but you can try it for yourself: https://codepen.io/benface/pen/PowOBRb. On browsers that don't support display: flow-root, the two red squares will be stacked horizontally (on the same row), while on browsers that do support it, they will be stacked vertically (due to the floats being cleared).

@lkraav
Copy link

lkraav commented Jan 4, 2020

Hubba-hubba, can this really replace display: inline-block; width: 100%; I've been using to prevent margin collapse 🎉

EDIT verified, works!

@adamwathan
Copy link
Member

@benface I'll merge this now if you want to fix conflicts 👍

@benface
Copy link
Contributor Author

benface commented Mar 18, 2020

@adamwathan Done!

@adamwathan adamwathan merged commit 018e1c8 into tailwindlabs:master Mar 18, 2020
@adamwathan
Copy link
Member

Merged 🤙🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants