How ‹table› Tag works in HTML
1.1 Introduction
The HTML ‹table› tag is used for defining a table. The table tag contains other tags that define the structure of the table. In other words, An HTML table consists of the ‹table› element and one or more ‹tr›, ‹th›, and ‹td› elements.
1.2 Syntax
‹table attribute="value"›Inside Tags‹/table›
‹table align="left" bgcolor="red" border="1px solid black"›
‹th›
Visit Lab
‹/th›
‹tr›
‹td›
content
‹/td›
‹/tr›
‹/table›
1.3 Attributes of ‹table› tag
Attribute | Value | Description |
---|---|---|
align | left, right, center | Defines the Visual alignment. |
bgcolor | rgb(x,x,x), #xxxxxx, colorname | Sets the a background color. |
border | pixels | Specifies the border width. A value of "0" means no border. |
width | pixels | Specifies the width of the table. |
height | pixels | Specifies the height of the table. |