Tag Archives: table

HTML th Tag for Table Column Headings

❰th❱ is for table column headings, which can span multiple columns. ❰th❱ description, syntax, usage, attributes and examples. is a great guide for web Series & Actors and Actresses. FollowTV SeriesandHTML 5on Google+.

ATTENTION: THIS PAGE ISValid HTML 5AND IS BEST VIEWED WITHHTML 5- Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information seeHTML 5 browsers.

HTML th Tag for Table Column Headings

Deprecated Elements

Design Pattern Catalog

JavaScript Patterns

JavaScript objects

JavaScript functions

JavaScript Tutorials

If you find this helpful, please click theGoogle

Buttonto the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.)

Thethtable heading cell tag divides a table row into individual cells, like thetd table detail cell tag, but is used for headings in a table. A column heading is usually included above a column in a table and can span multiple columns of the table, but other headings may appear elsewhere, such as the row headings in the example HTML table below. The style of a heading may be different from the rest of the cells in the same column or row – for example, by default the text is centered. In the table example below, there are three column headings and two row headings created by the th tag.

Multiple Column Heading

First Column Heading

Second Column Heading

This is an example of an HTML table footer.

This is an actual working demo of thetable heading example codebelow. (DoView Sourceto verify that this page is using theHTML 5 DOCTYPE. You can also verify it isValid HTML 5using theHTML Validator. Try using it to validate URLs with HTML examples from other places that claim to be HTML 5 web sites!)

The th tag is similar to thetd tagin that both can be used within atrelement. One important difference, however, is that while thetd tagis one of thesectioning root tags, which starts a newsection outlinefor the content of thetdelement, the th tag isnotand therefore contributes to the samesection outlineas its ancestors.

See the tutorial onCreating HTML Tablesfor full details onhow to create an HTML tableusing theHTML table tagstogether.

Make sure you understand thedifference between a tag and elementand are familiar with thedefinitionsofnamespaceand otherHTML terms.

elements, one for each heading cell in the row.

Begin the element for each heading cell with a starting th tag. The element name uses lower case letters and should be in theHTML namespace, which it will pick up automatically from the

Include anyattributesof the th tag as appropriate.The

attributeallow merging cells from multiple heading columns and/or rows.

closing tag. (To ensure tags match up properly, it helps to code the starting and ending tags first, then fill in between them.)

ending tag include the inner HTMLflow contentfor the heading.

elements for any additional headings in the same table row before the/tr tagfor the end of the row.

In addition to the personal attributes of the th tag below, any of thecommon HTML attributescan also be coded.

merges the cells from the specified number of columns into a single cell

merges the cells from the specified number of rows into a single cell

attribute ofthheadings applicable to the cell, separated by spaces if more than one

This might be used when some columns of the table are grouped under higher level headings. The individual column headings can reference the higher level heading groups, which would probably span multiple columns.

Here is the HTML code for theHTML table demoabove:

table captionTable Caption/caption colgroup col style=width: 20%/ col style=width: 80%/ /colgroup thead tr

th colspan=2Multiple Column Heading/th

/tr tr style=vertical-align: bottom

thFirst Column Heading/th

thSecond Column Heading/th

/tr /thead tfoot trtd colspan=2This is an example of an HTML table footer./td/tr /tfoot tbody tr tdRow 1 Column 1/td tdRow 1 Column 2/td /tr tr tdRow 2 Column 1/td tdRow 2 Column 2/td /tr /tbody /table

The following attributes shouldnotbe coded on the th tag because they either have been deprecated or were never officially supported:

The2000-2010 Recommendations from the W3C HTML Working Groupdefined theHTML namespacefor thethelement type name along with the names of allHTML element types. In older (pre-2000)versions of HTML, element type names were not associated with a namespace.

Watch TV shows onlineatTV Series . Includesfree TV show episodes. Now optimized for watching shows on Google TV and on tablets such as the Kindle Fire.