What is flex: 1 shorthand for?

CSS
What is flex: 1 shorthand for?

If you have used Flexbox before in CSS, you might have used the shorthand property flex: 1. And if you’re like me, you might have been using it but forgotten or not even known what this is shorthand for.

I know to use this shorthand when I have Flexbox items that I want to take up the rest of the space. It’s perfect for situations where you have an image on the left and a box of text on the right (product image and product name + price).

The shorthand translates to the following:

  • flex-grow: 1
  • flex-shrink: 1
  • flex-basis: 0

We won’t explain what each property does in detail because you have most likely used the non-shorthand versions before. But, we know this tells the browser we want an element to grow and shrink to the available space inside the Flexbox element.

What's Going on With CSS Houdini?

It has been years since CSS Houdini was revealed in 2016 and admittedly, it has been very slow going. Although, since the W3C task force was announced …

4 Somewhat Unknown CSS Layout Properties

CSS just continues to grow and evolve, much like its cousin Javascript. I thought I would share a few CSS layout properties that are still relatively …