© 2019 ClickStart – www.clickstart.net
display: table
display: table - why?
Vertical centered and/or equal height layouts ("cards")
display: table - pros/cons
Pros
▪ Vertical centering
▪ Can set equal heights
Cons
▪ Usually requires "extra" divs
▪ Overflow can be hard to handle
▪ Source order dependent
display: table - code
<div class="exDisplayTable">
<div class="tableRow">
<div class="tableCol">content...</div>
<div class="tableCol">content...</div>
</div>
</div>
div.exDisplayTable { display: table; }
div.tableRow { display:table-row; }
div.tableCol { display:table-cell; }
display: table - advanced option
▪ vertical-align: middle
display: table - print
▪ Lose horizontal alignment in Word
display: table - compatibility
display: flex
display: flex - why?
▪ Allow the container to alter its child items’ width, height, and order to best fill the available
space
▪ Content first
display: flex - pros/cons
Pros
▪ Considered "the future" of CSS layout
▪ Source order independent
▪ Vertical centering and equal heights