All Attributes Of Table Tag In Html

4 min read Jun 28, 2024
All Attributes Of Table Tag In Html

All Attributes of the Table Tag in HTML

The <table> tag in HTML is used to create tables for displaying data in a structured format. It has various attributes that you can use to customize the appearance and behavior of your tables. Here's a comprehensive list of all table tag attributes in HTML:

1. Basic Attributes:

  • border: This attribute defines the width of the border surrounding the table. You can specify a number in pixels or use "1" for a default border.

  ...
  • cellpadding: This attribute controls the space between the cell content and the cell border. It's expressed in pixels.

  ...
  • cellspacing: This attribute sets the space between the cells of the table. It's also expressed in pixels.

  ...
  • summary: This attribute provides a brief summary of the table's content. It's helpful for screen readers and search engines to understand the table's purpose.

  ...
  • width: This attribute sets the width of the table. You can specify a fixed pixel width or use percentages.

  ...

2. Advanced Attributes (HTML5)

  • align: This attribute controls the horizontal alignment of the table. It can take values like "left", "right", or "center". This attribute is deprecated in HTML5.

  • bgcolor: This attribute sets the background color of the table. This attribute is deprecated in HTML5. Use CSS for better styling control.

  • frame: This attribute determines which borders of the table should be displayed. It can take values like "void" (no borders), "hsides" (horizontal borders only), "vsides" (vertical borders only), "box" (all borders), or "above" (top border only). This attribute is deprecated in HTML5.

  • rules: This attribute controls which lines should be drawn between the table cells. It can take values like "none" (no lines), "rows" (horizontal lines only), "cols" (vertical lines only), "all" (all lines), or "groups" (lines only between table groups). This attribute is deprecated in HTML5.

  • valign: This attribute sets the vertical alignment of the content inside table cells. It can take values like "top", "middle", "bottom", or "baseline". This attribute is deprecated in HTML5.

Remember: Use CSS to style your tables in modern web development. CSS offers a much more flexible and powerful approach to controlling table appearance compared to these deprecated attributes.

Related Post