postcss-flexbugs-fixes icon indicating copy to clipboard operation
postcss-flexbugs-fixes copied to clipboard

The value of flex can mean different things

Open silvenon opened this issue 10 years ago • 7 comments

I didn't know this before, but apparently you can set flex to 30px and it will only set flex-basis, you can also set it to 1 30px, which sets flex-grow and flex-basis while skipping flex-shrink.

It looks like we have more work to do :pensive:

silvenon avatar Sep 13 '15 00:09 silvenon

What do you mean? We don't have to change anything when the css is using one of this values, right?

luisrudge avatar Sep 14 '15 12:09 luisrudge

flex: 30px means flex: 0 0 30px in IE10 instead of flex: 0 1 30px, so we do have to expand it :confused:

Check out the updated Flexbug 6.

silvenon avatar Sep 14 '15 13:09 silvenon

You shouldn't change flex: 30px to flex: 0 0 30px, that would be a bug. flex: 30px is equivalent to flex-basis: 30px, the rest should stay untouched as I understand it...

mgol avatar Feb 02 '16 13:02 mgol

Hmm, but for the same reason expanding flex: 1 to flex: 1 1 0% is probably wrong. Maybe the plugin should just generate a rule setting proper defaults:

* {
    flex: 0 1 0%;
}

and then change flex: 1 to flex-grow: 1 and flex: 30px to flex-basis: 30px?

mgol avatar Feb 02 '16 13:02 mgol

Does flex: 30px really just do flex-basis: 30px? My CSS-fu is a bit rusty, but I think CSS shorthands set everything else to default:

flex-shrink: 5;
flex: 30px;

I'm pretty sure that now flex-shrink has been reset to 1 (or 0 in IE's case). So turning flex: 30px into flex-basis: 30px would be incorrect.

silvenon avatar Feb 02 '16 14:02 silvenon

Ah, you're right. I got confused because Chrome Dev Tools seem to show it all incorrectly: This is the styles pane (I expanded the flex: 40px rule, Chrome should show to what it expands): screen shot 2016-02-02 at 16 44 11

And this is what I get in the console for this element: screen shot 2016-02-02 at 16 44 07

mgol avatar Feb 02 '16 15:02 mgol

Nice catch, you could perhaps raise an issue in DevTools.

silvenon avatar Feb 02 '16 16:02 silvenon