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:

17648 questions
4
votes
1 answer

How is a flex child's 100% width calculated?

When I set the .sidebar width to be 100%, it gets smaller than before. However, when I remove the body's font-size: 1.3rem and toggle the .sidebar's width: 100%, it gets slightly larger. I know that when we set the font-size to be 1.3rem,…
Fullchee Zhang
  • 103
  • 2
  • 7
4
votes
4 answers

Making a four square gallary of photos with CSS flexbox

So I am newish to programming. I understand there are tutorials on flexbox and great resources of understanding flex but none that are straightforward in the sense of understanding how to limit the number of photos you want in a single column with…
4
votes
3 answers

Horizontal scroll to left

I have a web page that sequentially adds various sizes of fixed width panels (flex: none) from left to right as the user drills down. When the panels reach (or will overreach) the end of the page I want the first panel (and subsequent panels) to…
Brett
  • 351
  • 3
  • 8
4
votes
3 answers

Why's CSS percentage (%) height applied to grand-child of flex element?

I'm trying to check how CSS 100% height property works. But there's one thing I can't understand. Why's 100% height working perfectly on .flex-grand-child (Chrome)? Does .flex-child have height property? So why it's even working??? Here's…
4
votes
3 answers

CSS sidebar with flexbox and static width

I'm trying to implement a sidebar with static width and flexbox. I have two issues: When the sidebar is closed, there is still space, and I don't understand where it comes from. The main side isn't animated. It's been pushed without…
undefined
  • 4,396
  • 5
  • 28
  • 60
4
votes
2 answers

How can I make flex items expand to the available width up to 4 elements per row?

I have a flexbox container and I would like the items within the container to use up as much width as they need in order to fill the entire width of the row. But I would also like to make it so that only 4 items can be in each row. So if there was 1…
user13286
  • 2,527
  • 6
  • 34
  • 70
4
votes
1 answer

flex-grow max value or shrink margin for space between elements

I'm building a navigation based on two lists on same line. All of the items in the two lists should have spacing between each other, but 25px at most. The problem with flex-grow: If I use flex-grow, the elements get bigger than their own width +…
NthDegree
  • 851
  • 11
  • 26
4
votes
3 answers

Make ALL flex-items wrap (like flex-direction: column) when any one flex-item too wide for flex-container

The use case for this is a responsive form with radio buttons. When on a big PC screen, all radio buttons normally fit in one line on the screen (like flex items in a non-wrapping flex container with flex-direction: row). On a phone, not all radio…
NULL pointer
  • 701
  • 7
  • 19
4
votes
0 answers

Setting first li element fixed and to have same layout as the none fixed li element

I have found that the first
  • element can be set to position: fixed; so that it does not scroll with other elements link. If I do this, the layout of this element will be broken, namely, the second li will overlap with the first. Not fixed…
  • khashashin
    • 859
    • 10
    • 30
    4
    votes
    2 answers

    Pure CSS Loading indicator fit to container size

    I want to use the following loading indicator for containers while data is being loaded. The problem is, that the slider has a fixed width and height (300px & 300px), but I want it to fit dynamically into a container. When I try to add width: 140px;…
    WhiteIntel
    • 667
    • 1
    • 8
    • 22
    4
    votes
    1 answer

    Why isn't position:sticky with left:0 working inside a scrollable container?

    I have this problem - I have a container that contains some rows and in each row there is a sticky left column and then multiple other columns. Now in the example below this works for a little while but as you scroll the parent container the…
    Smokey Dawson
    • 6,366
    • 10
    • 48
    • 114
    4
    votes
    1 answer

    Why doesn't flexbox shrink to fit after wrapping elements?

    I want to have a flex-box with a maximum width that wraps beyond that width, but that also fits the maximum size of any given "row" within the flexbox. The problem I am facing now is that any element that stretches beyond the maximum width and…
    Jeremy Schutte
    • 162
    • 2
    • 11
    4
    votes
    1 answer

    Difference between flex: 0 0 100% and flex: 1 1 100%

    I've tested the following but im asking, just in case there is a difference. I have a container that is a flex container. The items have a property of flex: 1 1 100%. Just for curiosity purposes, I've also tested flex: 0 0 100% and I haven't notice…
    Marco
    • 2,435
    • 4
    • 35
    • 56
    4
    votes
    6 answers

    Css flexbox gutter with spacing

    I'm trying to inline 3 items on 1 row. Every item must have a bit of space. The problem is when I add margin the third item will wrap. I already tried to add negative margin to the parent but that's not working. I made an example with my problem…
    Jamie
    • 8,230
    • 20
    • 68
    • 155
    4
    votes
    1 answer

    Why is width not updated properly inside flexbox?

    There is a very weird behavior that I cannot explain: Steps to reproduce: Create a flexbox container with non-empty
    and inside of it, set width to absolute value, like 150px. Disable cache and enable network throttling in browser…
    belkka
    • 236
    • 2
    • 9
    1 2 3
    99
    100