HTML -TABLE
HTML Table:
HTML tables allow web developers to arrange data into rows and columns. A table in HTML consists of table cells inside rows and columns.
• The HTML tables are created using the < table > tag in which the
- < table > - It defines a table.
- < th > - It defines a header in table. By default, the text in < th > elements are bold and center. th stands for table head.
- < tr > - is used to create table rows and < td > tag is used to create data cells. The elements under < td > are regular
and left aligned by default.
- < tr > - It defines a row in table. Each table row starts with a < tr > and end with a < /tr > tag. tr stands for table row.
- < td > - It defines a cell in table. Everything between < td > and < /td > are the content of the table cell. td stands for
table data.
Table Attributes :
border - This attribute is used to put a border across all the cells. If border is not required, we can use border = "0" and
it is deprecated.
cellspacing - It defines space between table cells.
cellpadding – It defines the distance between cell borders and the content within a cell.
colspan - It is used to merge two or more columns into a single column.
rowspan - It is used to to merge two or more rows.
More Tags in Table :
< caption > - The caption tag will serve as a title or explanation for the table and it shows up at the top of the table.
< tfoot > - It is used to create a separate table footer.
< thead > - It is used to group the header content in a table.
< tbody > - It is used to group the body content in a table.
Attributes in Table for Applying :
Background and Foreground fills :
background – It is used to set background image for whole table or just for one cell.
bgcolor – It is used to set background color for whole table or just for one cell.
bordercolor – It is used to set border color for the table.
Note: The border, bgcolor, background, and bordercolor attributes are deprecated in HTML5. Do not use these attributes.
« Previous
Next Topic »
(WebTech -Form)
|