Respuesta :

Answer:

HTML Tables are used to display tabular data in html. Table is defined within <table> tag and then table row <tr> and cells <td> or <th>. Table tag is the parent of table. Table can have rows, data, captions, colgroup, cols, etc.

Till 2005, whole website was build using table tag, but later or Div Based Layouts become popular as div based layouts are easy to build and maintain than table based layout. Also table is not scalable. Using a large table can block content loading. Table are also not responsive.

Tables are only used for structured data. Number of columns should remain same for each row. Although we can merge cells in row or columns.

caption tag is used inside table to add caption or title of table. Default text align of caption is center. Caption tag is always used as First Child of table element. Thus tr, thead, tbody or tfoot are used after table caption.

Following is a list of table attributes with use.

Table Caption

row 1, cell 1 row 1, cell 2

row 2, cell 1 row 2, cell 2

<table>

<caption>Table Caption<caption>

<tr>

<td>row 1, cell 1</td>

<td>row 1, cell 2</td>

</tr>

<tr>

<td>row 2, cell 1</td>

<td>row 2, cell 2</td>

</tr>

</table>

Table Width

In HTML table, width attribute was used to set width of table. In HTML5, width attribute is removed. CSS Width property is used to set width of table in html5. Width Attribute can also overflow table in mobile devices as screen width is lesser than table width.

Deprecated in HTML5, use css width.

How to set width of table.

Table with width 300

row 1, cell 1 row 1, cell 2

row 2, cell 1 row 2, cell 2