Sometimes you may want the layout properties that HTML tables have, but you don’t want the semantics of a table since you’re not really working with tabular data. A couple of examples are creating equal height boxes and making an unknown number of items flexibly occupy all available horizontal space.
In situations like these you can use CSS to tell any HTML elements you want to behave like they were tables, table rows, and table cells by using a combination of display:table
, display:table-row
, and display:table-cell
. You get the layout you want without littering your markup with tables that shouldn’t be there. But there is a slight catch.
Posted in (X)HTML, Accessibility, CSS.
Copyright © Roger Johansson