Suggest an editImprove this articleRefine the answer for “What does the <table> tag do?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**The `<table>` tag** creates a table in HTML and serves as the main container for all its elements: rows (`<tr>`), cells (`<td>`), headers (`<th>`), and logical sections (`<thead>`, `<tbody>`, `<tfoot>`). **Key point:** it does not display data by itself, but organizes it into rows and columns.Shown above the full answer for quick recall.Answer (EN)ImageThe `<table>` tag in HTML is used to **create a table** - a structure made up of rows and columns that hold data. It is a **container** for all the table's elements: rows (`<tr>`), cells (`<td>`), headers (`<th>`), and logical sections (`<thead>`, `<tbody>`, `<tfoot>`). --- ### Main function The `<table>` tag groups and displays data **in tabular form** - like a grid where rows and columns intersect in cells. --- ### Example: ```html <table> <tr> <th>Name</th> <th>Age</th> </tr> <tr> <td>Maria</td> <td>25</td> </tr> <tr> <td>Oleh</td> <td>30</td> </tr> </table> ``` **What happens here:** - `<table>` - creates the table. - `<tr>` - adds a row. - `<th>` - makes a cell a header (bold, centered). - `<td>` - adds a regular data cell. --- ### `<table>` tag attributes (outdated, but still seen) - `border` - adds a border around the table. ```html <table border="1">...</table> ``` - `cellpadding` - sets the inner padding inside cells. - `cellspacing` - the spacing between cells. > Nowadays **CSS** is used to style tables instead of these attributes. --- ### Example with CSS: ```html <table> <tr> <th>Item</th> <th>Price</th> </tr> <tr> <td>Bread</td> <td>$40</td> </tr> </table> <style> table { border-collapse: collapse; width: 300px; } th, td { border: 1px solid #333; padding: 8px; text-align: left; } </style> ``` --- ### Conclusion: The `<table>` tag creates a table and serves as the **main container** for all its elements. It does not display data by itself, but it organizes it into **rows and columns**, providing a structured and visually clear representation of information.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.