例如,你不應該能夠看到父母的紅色在這裏,但你這樣做,因爲parent: 0 0 auto
正在調整父級的大小到其子內容的自動寬度。你可以清楚地看到,它的內容真正的寬度是10px,所以它的自動調整大小不應該使父母10px?`flex-basis:auto` size parent如同孩子是`flex-basis:auto`,當孩子是`flex-basis:10px`時
body{
display:flex;
}
#parent {
flex: 0 0 auto;
background-color: red;
}
#child {
flex: 0 0 10px;
background-color: grey;
}
div{ display:flex; min-width:0; min-height:0; overflow:hidden; } /*There's some weirdness described here, http://stackoverflow.com/questions/36247140/why-doesnt-flex-item-shrink-past-content-size where flex elements default to min-width:auto, which could have caused problems here, but this doesn't change anything, so apparently this is not the issue*/
<div id="parent">
<div id="child">childcontents</div>
</div>
這發生在Firefox和Chrome,所以想必這會變成是正確莫名其妙。我想知道如何,以便我可以阻止它。