How (and why) to use display: table-cell (CSS)

后端 未结 4 545
再見小時候
再見小時候 2020-12-13 04:37

I have a site with a very active background (I\'m talking 6 or so different z-indexes here 2 with animations). I wanted a in the foreground that had conten

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 05:05

    The display:table family of CSS properties is mostly there so that HTML tables can be defined in terms of them. Because they're so intimately linked to a specific tag structure, they don't see much use beyond that.

    If you were going to use these properties in your page, you would need a tag structure that closely mimicked that of tables, even though you weren't actually using the

    family of tags. A minimal version would be a single container element (display:table), with direct children that can all be represented as rows (display:table-row), which themselves have direct children that can all be represented as cells (display:table-cell). There are other properties that let you mimic other tags in the table family, but they require analogous structures in the HTML. Without this, it's going to be very hard (if not impossible) to make good use of these properties.

    提交回复
    热议问题