HTML CSS examples for HTML Tag:table
There are three elements that every table must have: table, tr, and td.
The table Element summary
Item | Value |
---|---|
Element: | table |
Local Attributes: | border |
Contents: | The caption, colgroup, thead, tbody, tfoot, tr, th, and td elements |
Tag Style: | Start and end tags |
New in HTML5? | No |
Changes in HTML5 | The summary, align, width, bgcolor, cellpadding, cellspacing, frame, and rules attributes are obsolete. Use CSS instead. The value of the border attribute must be 1. The thickness of the border is set using CSS. |
Style Convention
table { display: table; border-collapse: separate; border-spacing: 2px; border-color: gray; }
The following code shows how to use table element.
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <table> <tbody> <tr> <td>Col 1</td> <td>Col 2</td> <td>Col 3</td> </tr> <tr> <td>Col 1</td> <td>Col 2</td> <td>Col 3</td> </tr> </tbody> </table> </body><!--from w ww . j a va 2 s. c o m--> </html>