Pure CSS Table
CSS can emulate HTML Table tag. So, traditional layout using the table tag can be done with pure CSS.
Here is a example of CSS table rendered in your browser:
one
two
three
four
five
six
Here is the HTML code:
<div class="xtable722"> <div class="xrow72"> <div class="xcell72">one</div> <div class="xcell72">two</div> </div> <div class="xrow72"> <div class="xcell72">three</div> <div class="xcell72">four</div> </div> <div class="xrow72"> <div class="xcell72">five</div> <div class="xcell72">six</div> </div> </div>
Here is the CSS code:
.xtable722 { border:solid thin red; display:table; } .xrow72 { display:table-row; } .xcell72, .xcell72 { display:table-cell; border:solid thin red; }
CSS Attributes for Table Layout
Here is a full list of values for the display
attribute to emulate table tags.
CSS | HTML |
---|---|
display:table | HTML table |
display:table-row | tr (row) |
display:table-cell | td (table cell) |
CSS | HTML |
---|---|
display:table-caption | caption |
display:table-header-group | thead (table header row; th group) |
display:table-footer-group | tfoot (table footer row) |
〔see HTML Table, thead, tbody, tfoot〕
CSS | HTML |
---|---|
display:table-row-group | tbody |
display:table-column | col |
display:table-column-group | colgroup |
〔see HTML Table, colgroup, col〕
HTML Table
CSS, Layout
- CSS: Display Property
- Pure CSS Table
- CSS: 3-Column Side-Panel Layout
- CSS: Newspaper Text-Flow Over Multi-Column Layout
- CSS: Text Flow Around Image
- CSS: Hide Element (visibility)
CSS, Layers
- CSS: Position Property
- CSS: Fix Element to Window
- CSS: Position: Relative
- CSS: Absolute Position
- CSS: Text Over Image
- CSS: z-index