Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

table-header-group and table-footer-group in a Div

Is there a way of using table-header-group and table-footer-group in a div instead of in a thead or tfoot?

like image 233
Paul Avatar asked Jan 12 '10 12:01

Paul


People also ask

How do you group the footer content in a table?

The <tfoot> tag is used to group footer content in an HTML table. The <tfoot> element is used in conjunction with the <thead> and <tbody> elements to specify each part of a table (footer, header, body). Browsers can use these elements to enable scrolling of the table body independently of the header and footer.

How do you group the header content in a table in HTML?

In this article, we define to group the header content in a table by using the <th> tag in HTML to set the header cell of a table. Two types of cells in an HTML table. Header Cell: It is used to hold the header information. Standard Cell: It is used to hold the body of data.

What is table header group in CSS?

ⓘ thead – table heading group. The thead element represents the block of rows that consist of the column labels (headings) for its parent table element.

Which element represents a group of table header cells?

<th>: The Table Header element. The <th> HTML element defines a cell as header of a group of table cells. The exact nature of this group is defined by the scope and headers attributes.


2 Answers

According to www.w3.org it is allowd to use display: table-header-group when the parent (the element containing the div) is displayed as a table or inline-table. So something like this should be allowed

<table>
  <div style="display: table-header-group;">header group</div>
</table>

If the parent is not a table, then it should be inserted, according to point 4 on the www.w3.org page.

The big problem is, whether all (major) browsers support this. Especially IE(6) is known for not supporting most kinds of display types.

like image 145
Veger Avatar answered Nov 01 '22 04:11

Veger


According to W3C you cannot use a element as a direct child node inside of a <table>. http://w3schools.com/html5/tag_table.asp. This article states that a <table> may contain:

  • tr
  • td
  • th
  • caption
  • col
  • colgroup
  • thead
  • tfoot
  • tbody

what you could do if you want to avoid using a table is:

<div style="display:table;">
  <div style="display:table-header-group;">header group</div>
</div>

This solution however, is only possible in HTML5.

like image 38
adrian Avatar answered Nov 01 '22 03:11

adrian