Given:
.layout {
display: flex;
flex-wrap: nowrap;
align-items: stretch;
}
.layout aside,
.layout main {
min-width: 100px;
}
.layout aside {
flex: 0 0 content;
background-color: red;
}
.layout main {
flex: 1 1 content;
background-color: green;
}
<div class="layout">
<aside>
<p>Line 1</p>
</aside>
<main>
<p>Line 1</p>
<p>Line 2</p>
<p>Line 3</p>
</main>
</div>
Live example
My intentions are:
but if I run that code and inspect it with Chrome I get the following error on both flex:
statements:
Invalid property value
and moreover the green box doesn't expand on the right as it should. My Chrome version is 56.0.2924.87 (64-bit) on Mac OS X 10.11.5.
What am I doing wrong?
The Invalid Property Value error is issued in the following situations: Message <property> must be set in <element> Cause. There's a mandatory property in <element> that you haven't set.
Flexbox is very well supported across modern browsers, however there are a few issues that you might run into. In this guide we will look at how well flexbox is supported in browsers, and look at some potential issues, resources and methods for creating workarounds and fallbacks.
If the items don't have a size then the content's size is used as the flex-basis. This is why when we just declare display: flex on the parent to create flex items, the items all move into a row and take only as much space as they need to display their contents.
flex-basis: content
is a valid rule, but it's not supported by all browsers yet.
From the spec:
content
Note: This value was not present in the initial release of Flexible Box Layout, and thus some older implementations will not support it. The equivalent effect can be achieved by using
auto
together with a main size (width
orheight
) ofauto
.
Also see MDN for a brief history of the content
value: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis#Values
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With