HTML th tag

## HTML Reference

HTML by Alphabet HTML by Function HTML Global Attributes HTML Events HTML Canvas HTML Audio/Video HTML Doctypes HTML Colornames HTML Colorpicker HTML Colormixer HTML Character Sets HTML ASCII HTML ISO-8859-1 HTML Symbols HTML URL Encode HTML Lang Codes HTTP Messages HTTP Methods Keyboard Shortcuts

## HTML Tags

<!--> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <command> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <head> <header> <h1> - <h6> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <keygen> <label> <legend> <li> <link> <map> <mark> <menu> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

# HTML <th> Tag

« HTML Reference
<thead> Tag »

## Example

A simple HTML table with two header cells and two data cells:

<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
Try it yourself »
(more examples at the bottom of this page)

## Browser Support

The <th> tag is supported in all major browsers.

## Definition and Usage

The <th> tag defines a header cell in an HTML table.

An HTML table has two kinds of cells:

- Header cells - contains header information (created with the <th> element)
- Standard cells - contains data (created with the <td> element)

The text in <th> elements are bold and centered by default.

The text in <td> elements are regular and left-aligned by default.

## Tips and Notes

Tip: Use the colspan and rowspan attribute to let the content span over multiple columns or rows!

## Differences Between HTML 4.01 and HTML5

Some HTML 4.01 attributes are not supported in HTML5.

## Attributes

Attribute | Value | Description
--- | --- | ---
abbr | text | Not supported in HTML5. Specifies an abbreviated version of the content in a header cell
align | left right center justify char | Not supported in HTML5. Aligns the content in a header cell
axis | category_name | Not supported in HTML5. Categorizes header cells
bgcolor | rgb(x,x,x) #xxxxxx colorname | Not supported in HTML5. Deprecated in HTML 4.01. Specifies the background color of a header cell
char | character | Not supported in HTML5. Aligns the content in a header cell to a character
charoff | number | Not supported in HTML5. Sets the number of characters the content will be aligned from the character specified by the char attribute
colspan | number | Specifies the number of columns a header cell should span
headers | header_id | Specifies one or more header cells a cell is related to
height | pixels % | Not supported in HTML5. Deprecated in HTML 4.01. Sets the height of a header cell
nowrap | nowrap | Not supported in HTML5. Deprecated in HTML 4.01. Specifies that the content inside a header cell should not wrap
rowspan | number | Specifies the number of rows a header cell should span
scope | col colgroup row rowgroup | Specifies whether a header cell is a header for a column, row, or group of columns or rows
valign | top middle bottom baseline | Not supported in HTML5. Vertical aligns the content in a header cell
width | pixels % | Not supported in HTML5. Deprecated in HTML 4.01. Specifies the width of a header cell

## Global Attributes

The <th> tag also supports the Global Attributes in HTML.

## Event Attributes

The <th> tag also supports the Event Attributes in HTML.

## Try it Yourself - Examples

Table headers
How to create table headers.

Empty cells
How to use "&nbsp;" to handle cells that have no content.

Table with a caption
An HTML table with a caption.

Tags inside a table
How to display elements inside other elements.

Cells that span more than one row/column
How to define table cells that span more than one row or one column.

## Related Pages

HTML tutorial: HTML Tables

HTML DOM reference: Th object

« HTML Reference
<thead> Tag »

## Your suggestion:

Your E-mail (optional):

Page address:

Description:

Close [X]

## Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

## WEB HOSTING

Best Web Hosting UK Reseller Hosting Wow! $5 SSD Hosting

## WEB BUILDING

Download XML Editor
FREE Website BUILDER FREE Website Creator

## WEB RESOURCES

Web Statistics Web Validation

## SHARE THIS PAGE