elibraryportal Logo

HTML Table Tag

HTML Table tag is used to arrange data into rows and columns.

⟼ We can display data in tabular form, using <table> element, with the help of <tr> , <td>, and <th> elements.

Syntax Follow:-

Example:-

Output-:

HTML Table Tag Example

Table Attributes or Property

⟼ Table Attributes specify Two way.

  1. Border Attribute
  2. CSS use

1) HTML Border Attribute

Syntax:-

Example:-

Output-:

HTML Table Border Example

2) CSS Border Property

CSS use for Border Property.

Example:-

Output-:

HTML Table Border Example

HTML Cell Padding Table

Two way use Cell Padding Table

  1. Collapsed Borders Property
  2. Cellpadding and Cellspacing

1) Collapsed Borders Property

border-collapse By default, adjust cells will have their own distinct border..

Syntax:-

2) Cellpadding and Cellspacing

Cellpadding specifies the space between the cell content and its borders.If you do not specify a padding, the table cells will be displayed without padding.

Cellspacing The cellspacing attribute defines space between table cells

Syntax:-

Example:-

Output-:

HTML Table Border Cellpadding and Cellspacing Example

HTML Table Colspan

⟼ HTML Table Colspan divide one cell, in multiple number of columns depend on the value of colspan attribute.

Syntax:

Example:

Output-:

HTML Colspan Example

HTML Table Rowspan

⟼ HTML Table Rowspan divide one rows, in multiple number of rows depend on the value of rowspan attribute

Syntax:

Example:

Output-:

HTML rowspan Example