Flex elements ignore percent padding in Firefox

See https://lists.w3.org/Archives/Public/www-style/2015Sep/0038.html Grid/Flex Percentages The group tried to work through how vertical percentage margins and paddings are defined. Note: Top and bottom margins in CSS have traditionally resolved against the containing block width instead of its height, which has some useful effects but is generally surprising. Existing layout modes must of course continue to do … Read more

First-child full-width in Flexbox

You can set the :first-child to a width of 100%, and the rest of the childs :not(:first-child) to flex: 1. To put them on multiple lines, use flex-wrap: wrap on the container: .container { display: flex; justify-content: space-between; flex-wrap: wrap; background: #e2eaf4; padding: 10px; } .child { display: inline-block; font-family: “Open Sans”, Arial; font-size: 20px; … Read more

Making a flex item float right

You can’t use float inside flex container and the reason is that float property does not apply to flex-level boxes as you can see here Fiddle. So if you want to position child element to right of parent element you can use margin-left: auto but now child element will also push other div to the … Read more

What exactly flex-basis property sets?

flex-basis allows you to specify the initial/starting size of the element, before anything else is computed. It can either be a percentage or an absolute value. It is, however, not the breaking point for flex-grow/shrink properties. The browser determines when to wrap the element on the basis of if the initial sizes of elements exceed … Read more

Sizing flex items on the last row

Unfortunately, in the current iteration of flexbox (Level 1), there is no clean way to solve the last-row alignment problem. It’s a common problem. It would be useful to have a flex property along the lines of: last-row last-column only-child-in-a-row alone-in-a-column This problem does appear to be a high priority for Flexbox Level 2: CSS … Read more

Fitting child into parent

An initial setting on flex items is min-width: auto. This means that flex items cannot be shorter than the width of their content. You have white-space: nowrap on the text element. As a result, all flex item ancestors must expand (in a domino effect) to accommodate the length of the text. The affected flex items … Read more

Sticky footer with flexbox

Yes, this is a normal set-up. That’s what justify-content: space-between is supposed to do: Pin the first and last elements to the edges of the container. main { display: flex; flex-direction: column; justify-content: space-between; height: 100vh; } article { background-color: lightgreen; } footer { background-color: orangered; } body { margin: 0; } <main> <article>inner div</article> … Read more