HTML CSS Bootstrap Javascript Icons Python
HTML References
HTML - Tag Reference HTML - Tag by Category HTML - Attributes HTML - Global Attributes HTML - Events HTML - Language Codes HTML - Country Codes HTML - URL Encoding HTTP Methods HTTP Status Codes <input> types
All 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> <data> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <h1> - <h6> <head> <header> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <main> <map> <mark> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <picture> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <svg> <table> <tbody> <td> <template> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

HTML <table> tag

The HTML <table> element is used for defining a table.

The <table> element contains other tags that define the structure of the table.

Run code

The <tr> element defines a table row, the <th> element defines a table header, and the <td> element defines a table cell.

A more complex HTML table may also include <caption>, <col>, <colgroup>, <thead>, <tfoot>, and <tbody> elements.

Browser compatibility

The <table> element is fully supported by all browsers:

Element
<table> yes yes yes yes yes



Attributes

The following table shows the attributes that are specific to the <table> tag:

Attribute Value Description
align left
center
right
Not supported in HTML5.
Specifies the alignment of a table according to surrounding text
bgcolor color_value Not supported in HTML5.
Specifies the background color for a table
border 1
0
Not supported in HTML5.
Specifies the border width. A value of "0" means no border
cellpadding pixels Not supported in HTML5.
Specifies the space between the cell borders and their contents
cellspacing pixels Not supported in HTML5.
Specifies the space between cells
frame void
above
below
hsides
lhs
rhs
vsides
box
border
Not supported in HTML5.
Specifies which parts of the outside borders that should be visible
rules none
groups
rows
cols
all
Not supported in HTML5.
Specifies which parts of the inside borders that should be visible
summary text Not supported in HTML5.
Specifies the summary of the content
width pixels
%
Not supported in HTML5.
Specifies the width of the table

Global Attributes

The <table> tag supports the global attributes described in HTML Global Attributes Reference

Event Attributes

The <table> tag supports the event attributes described in HTML Events Reference

Last updated: Monday 01 Oct, 2018