Ich habe eine äußere div
, die ich als Tabelle anzeigen, und und 2 innere divs
.Warum zeigt meine CSS-Tabelle die Höhe für ein Element mit der maximalen Höhe 0 an?
Das erste innere div ist nach links schwebend. Die zweite innere div hat eine maximale Höhe von 0.
.d-table {
display: table;
border: solid 1px black;
}
.float-left{
\t float: left;
}
.hidden{
max-height: 0px;
overflow-y: hidden;
\t clear: both;
}
<div class="d-table">
<div class="float-left">
hey
</div>
<div class="hidden">
cool
</div>
</div>
Erwartetes Ergebnis ist:
tatsächliche Ergebnis ist:
Die Tabelle berücksichtigt das Div mit einer Höhe von 0 aus irgendeinem Grund.
Ja, da Tabellenzellen einen Blockformatierungskontext erstellen, ist eine Freigabe wahrscheinlich nicht erforderlich. – Oriol