Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS Flexbox Layout

Featured Replies

I am wondering if to create a new website using the CSS Flexbox Layout, is it good now good practice when creating a layout to use Flexbox?

Does Flexbox work well cross-browser and with older browsers?

 

  • Author

Thanks, it still looks like using Flexbox is still quite new and a lot of workarounds are needed for cross-browser support and older browsers.

 

This maybe useful for others 'A Complete Guide to Flexbox' at https://css-tricks.com/snippets/css/a-guide-to-flexbox/

 

I think for me, Flexbox is too advanced to use for my knowledge.

Flexbox is designed for specific cases where other methods fall short, it's not a replacement for other display properties, and it's pretty bad at creating re-usable grid systems. Display inline block should be suitable for most cases, occasionally you may have to use a bit of flexbox or similar, but that should be uncommon.

  • 2 weeks later...

Flexbox is designed for specific cases where other methods fall short, it's not a replacement for other display properties, and it's pretty bad at creating re-usable grid systems. Display inline block should be suitable for most cases, occasionally you may have to use a bit of flexbox or similar, but that should be uncommon.

Disagree. Flex box is most defiantly a better approach then float or inline block and can be used to overcome several short comings of each.

Not sure floating was designed for grid layouts, and neither were tables but that has been the way of the web since its inception, that everything is used for something else if it's found to work, and really why not?

 

While I'm here:

The CSS3 Flexible Box, or flexbox, is a layout mode intended to accommodate different screen sizes and different display devices. For many applications, the flexible box model is easier than the block model since it does not use floats, nor do the flex container's margins collapse with the margins of its contents.

 

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes

 

So it sort of is for layouts as an improved alternative to floating divs

Edited by TimW

It's good for layout components. It's not necessarily good for the whole site (but it can be done)

 

For example, flexbox works well if you have a row of boxes. You can use media queries to align horizontally for large screens and vertically for small screens. It does this very well

 

https://css-tricks.com/snippets/css/a-guide-to-flexbox/

Disagree. Flex box is most defiantly a better approach then float or inline block and can be used to overcome several short comings of each.

 

I didn't say flexbox wasn't better, but you can achieve a lot with inline-block without any fallback for older browsers. Flexbox is designed to solve specific use cases in layout, not as a grid system, which is why CSS grid is now a spec, and it's noticeably better than trying to do the same with flexbox.

Disagree. Flex box is most defiantly a better approach then float or inline block and can be used to overcome several short comings of each.

No it's not. Flexbox doesn't work well when dealing with asynchronously loaded content, causing the page to re-render in a jarring manner. Jack is right in his statement above.

 

Take a look at the grid I created here https://nebulaui.github.io/nebula/api/objects/grid?GridActiveTabId=options

 

Out of all the options presented the only time this grid uses flexbox is for equal height items. Flexbox is just a tool like any other and didn't replace anything.

No it's not. Flexbox doesn't work well when dealing with asynchronously loaded content, causing the page to re-render in a jarring manner. Jack is right in his statement above.

 

Take a look at the grid I created here https://nebulaui.github.io/nebula/api/objects/grid?GridActiveTabId=options

 

Out of all the options presented the only time this grid uses flexbox is for equal height items. Flexbox is just a tool like any other and didn't replace anything.

Yes, and what I see is a bunch more mark up than is needed and sections that don't expand to match when there is more content in one vs the other.

 

Not to mention the benefit on page performance, if your into that sort of thing:

https://developers.google.com/web/fundamentals/performance/rendering/avoid-large-complex-layouts-and-layout-thrashing

Edited by bwclovis

If you want to be really pedantic: people use grids and float and flex and other tools to create a layout they like.

 

In many cases this produces something pretty but isn't that usable - especially when you consider most non-business browsing it done with tablets and phones.

 

So why not build mobile first. Create a layout that works well on a smaller screen and scale up. You often discover that a simple vertical scrolling layout without rows of content boxes and animations and whatever work just as well.

Yes, and what I see is a bunch more mark up than is needed and sections that don't expand to match when there is more content in one vs the other.

 

Not to mention the benefit on page performance, if your into that sort of thing:

https://developers.google.com/web/fundamentals/performance/rendering/avoid-large-complex-layouts-and-layout-thrashing

I do a lot of performance optimisations as part of my job and an extra few `<div>` tags which actually often isn't the case with flexbox will make zero difference. If you are worried about that then you are guilty of prematurely optimising.

The rendering time of flexbox is an order of magnitude more costly than a small amount of extra markup. But that's not the issue here. The issue is that flexbox layout is typically dictated by content so as content gets loaded asynchronously the layout has to be re-calculated after the initial render.

re-rendering an entire view is costly in terms of layout calculations and paints. Essentially flexbox can result in layout thrashing just like the link you sent describes.

A bit of extra markup to render does not result in thrashing.

 

Markup becomes a performance issue when you're comparing thousands of extra nodes.

Edited by rbrtsmith

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.