CSS Table

tutorial and example
tutorial and example

CSS table provides better look and feel. There are various properties of CSS table that are given below.

  • border
  • border-collapse
  • padding
  • width
  • height
  • text-align
  • color
  • background-color

CSS Table Border

You can set the border of the table by using table tag th and td.

Example

Try Now

Collapse Table Borders

You can collapse the table border by using its property.

Example

Try Now

CSS Table Padding

You can specify the padding of table header and table data by using CSS padding property.

Try Now

Responsive table

A responsive table is used to create responsive table. It will display horizontal scroll bar if the screen is too small. You should use only overflow-x: auto properties.

Try Now

CSS Table Properties

Property Description
Border It is used to set the border properties in one declaration.
border-collapse It specifies whether table borders should be collapsed.
border-spacing It specifies the distance between the borders of adjacent cells.
Caption-side It specifies the placement of a table caption.
Empty-cells It specifies the borders and background on empty cells in a table.
Table-layout It is used to set the layout algorithm to be used for a table.