Questions tagged [flexbox]

CSS module for flexible layouts providing a broad range of options for aligning elements while eliminating the need for floats and tables.

In the flex layout model, the children of a flex container can be laid out in any direction, in any order (independent of source order), and can "flex" their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent. Both horizontal and vertical alignment of the children can be easily manipulated. Nesting of these boxes (horizontal inside vertical, or vertical inside horizontal) can be used to build layouts in two dimensions.


Flexbox Specification


Modern Flexbox Articles

Articles

Browser Support Information

Canonical Questions & Answers:

21882 questions
92
votes
1 answer

Difference between flex-end and end?

When I use the css property align-items, I cannot see any visual difference with the value of flex-end or value of end. What is the difference between align-items: end and align-items: flex-end?
Sølve T.
  • 4,159
  • 1
  • 20
  • 31
92
votes
2 answers

What's the difference between flex-start and baseline?

When working with flex align-* properties, what's the difference between flex-start and baseline? The below code snippet gives same output for align-self: flex-start and align-self: baseline. In which cases will align-self: flex-start and…
Zameer Ansari
  • 28,977
  • 24
  • 140
  • 219
92
votes
10 answers

Flexbox column align self to bottom

Im trying to use Flexbox. http://css-tricks.com/almanac/properties/a/align-content/ this shows nice alignment options; but i would actually want a Top-top-bottom situation. I want a div to stick to the bottom of the parent div using flexbox. With…
Laurens Kling
  • 2,221
  • 1
  • 21
  • 31
90
votes
1 answer

flex vs flexGrow vs flexShrink vs flexBasis in React Native?

I finally upgraded react native to 0.42 which includes the introduction of flexGrow, flexShrink, and flexBasis and the change (or fix) of how flex is rendered. I keep getting errors like: View was rendered with explicitly set width/height but with…
Dev01
  • 13,292
  • 19
  • 70
  • 124
90
votes
1 answer

Flex items not shrinking when window gets smaller

I'm trying to fit two plotly plots next to each other inside a CSS flexbox. I want them to resize when the window is resized. It works as expected when the window grows, but the plots don't shrink when the window gets smaller. var trace1 =…
Alexander Schlüter
  • 1,089
  • 1
  • 8
  • 7
90
votes
1 answer

Specifing width of a flexbox flex item: width or basis?

Say I'm doing 3 flex columns, first one 50%, the other two auto adjust. .half { flex: 0 0 auto ; width: 50% ; } or .half { flex: 0 0 50%; } These seem to be functionally the same. Are they?
Doug Cassidy
  • 1,796
  • 3
  • 17
  • 28
90
votes
6 answers

css grid of squares with flexbox

I am trying to create a responsive grid of squares. The squares should resize to fit the viewport's width. The squares should not resize when changing the viewport's height. I got how to adjust the width of each square, but I don't know how to make…
Moto
  • 1,131
  • 2
  • 10
  • 15
89
votes
2 answers

How to center-align one flex item and right-align another using Flexbox

I am totally new to Flexbox and wanted to align buttons, but I could not see how to handle the common case with a center-aligned button and a right-aligned button on the same row using only Flexbox. However, I found a way that used an invisible…
resander
  • 1,181
  • 2
  • 11
  • 15
89
votes
3 answers

CSS Flex Box Layout: full-width row and columns

Hello fellow programmers! I've got a simple box-layout which I would love to achieve using flexbox, but I simply can't figure it out. It should look like this image. So basically a row and two columns, with the row being fixed at lets say 100px in…
Androvich
  • 1,030
  • 1
  • 7
  • 11
88
votes
1 answer

white-space: nowrap breaks flexbox layout

I have created a responsive layout for an app using Flexbox. The layout calls for a collapsible menu on the left, a block with a header and body in the middle and a toggleable help-pane on the right (there's more to it but that's the basic…
PieBie
  • 3,259
  • 2
  • 18
  • 27
88
votes
4 answers

Make container shrink-to-fit child elements as they wrap

I'm trying to figure out how flexbox works (supposed to work?…) for cases like below: .holder { width: 500px; background: lightgray; display: flex; flex-direction: row; justify-content: space-between; flex-wrap: nowrap; } .v2 { …
Mikhail Kornienko
  • 1,162
  • 1
  • 8
  • 12
88
votes
14 answers

How to keep wrapped flex-items the same width as the elements on the previous row?

I have a
    that is a flex-box and a bunch of
  • s in it which are the flex-items. I am trying to get the
  • to have a flexible width, that stays between two sizes using min-width and max-width. It works great as long as they are on the same…
midu
  • 1,589
  • 1
  • 9
  • 14
87
votes
3 answers

How to display 3 items per row in flexbox?

I have a list and I want to display my li elements horizontally and 3 per row. I've been trying to get what I want, but no luck. Is there a solution?
Youssef Boudaya
  • 887
  • 2
  • 17
  • 29
87
votes
3 answers

flex child is growing out of parent

How to force the green boxes to be contained in the red one without setting a static height value and no absolute position? I want to shrink the content to fit into the parent. The content (video in this case) is allowed to shrink and scrollbars are…
Exlord
  • 5,009
  • 4
  • 31
  • 51
87
votes
9 answers

Aligning elements left and center with flexbox

I'm using flexbox to align my child elements. What I'd like to do is center one element and leave the other aligned to the very left. Normally I would just set the left element using margin-right: auto. The problem is that pushes the center element…
Carl Edwards
  • 13,826
  • 11
  • 57
  • 119