For me, the expected behavior would be that the middle cell fills the whole space horizontally as long as its container is not wider than 500px. However, it doesn't matter how large I scale the page, the middle cell always fills up 100%, ignoring the max-width property, and the chocolate never shows :(
div.container {
width: 100%;
display: table;
}
div.container > * {
display: table-cell;
}
div.middle {
width: 100%; max-width: 500px;
background-color: black;
}
div.side {
width: auto;
background-color: chocolate;
}
<div class="container">
<div class="side"></div>
<div class="middle">.</div>
<div class="side"></div>
</div>
What causes the problem, and what could be a workaround?