MOCKSTACKS
EN
Questions And Answers

More Tutorials









HTML Tables

HTML tables arrange data into rows and columns.

A table in HTML consists of table cells inside rows and columns

Each table cell is defined by a <td> and a </td> tag.
Everything between <td> and </td> are the content of the table cell.


Example of table

Company Contact Country
Alfreds Futterkiste Maria Anders Germany
Centro comercial Moctezuma Francisco Chang Denver

Example

<table>
    <tr>
        <th>Company</th>
        <th>Contact</th>
        <th>Country</th>
    </tr>
    <tr>
        <th>Alfreds Futterkiste</th>
        <th>Maria Anders</th>
        <th>Germany</th>
    </tr>
    <tr>
        <th>Centro comercial Moctezuma</th>
        <th>Francisco Chang</th>
        <th>Denver</th>
    </tr>
</table>


<tr> tag

tr stands for table row

Each table row starts with a <tr> and end with a </tr> tag.


<table>
    <tr>
        <td>data</td>
    </tr>
</table>

<th> tag

th stands for table heading

Sometimes you want your cells to be headers, in those cases use the <th> tag instead of the </th> tag:


<table>
    <tr>
        <th>table heading 1</th>
        <th>table heading 2</th>
        <th>table heading 3</th>
    </tr>
</table>

<td> tag

td stands for table data

Everything between <td> and </td> are the content of the table cell.


<table>
    <tr>
        <td>table data 1</td>
        <td>table data 2</td>
        <td>table data 3</td>
    </tr>
</table>

Conclusion

In this page (written and validated by ) you learned about HTML Tables . What's Next? If you are interested in completing HTML tutorial, your next topic will be learning about: HTML Table Border.



Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: mockstacks@gmail.com.


Share On:


Mockstacks was launched to help beginners learn programming languages; the site is optimized with no Ads as, Ads might slow down the performance. We also don't track any personal information; we also don't collect any kind of data unless the user provided us a corrected information. Almost all examples have been tested. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. By using Mockstacks.com, you agree to have read and accepted our terms of use, cookies and privacy policy.