Contents
table HTML: Main Tips
- The
<table>
element describes an HTML table. - The
<table>
element contains <tr>, <th>, and <td> elements. - It can also contain optional <tbody>, <tfoot>, <col>, <thead>, <colgroup> and <caption> elements.
- This tag supports global attributes in HTML.
Defining a Table in HTML
By using table
HTML tags, you can include a table with rows and columns in the web page:
<table>
<tr>
<th>Place</th>
<th>Animal</th>
</tr>
<tr>
<td>Space</td>
<td>Dog</td>
</tr>
</table>
To style your table, you can use CSS properties. If you don't, these values will be set by default:
table {
display: table;
border-color: gray;
border-collapse: separate;
border-spacing: 2px;
}
- Easy to use with a learn-by-doing approach
- Offers quality content
- Gamified in-browser coding experience
- The price matches the quality
- Suitable for learners ranging from beginner to advanced
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
- Simplistic design (no unnecessary information)
- High-quality courses (even the free ones)
- Variety of features
- Nanodegree programs
- Suitable for enterprises
- Paid Certificates of completion
- A wide range of learning programs
- University-level courses
- Easy to navigate
- Verified certificates
- Free learning track available
- University-level courses
- Suitable for enterprises
- Verified certificates of completion
Deprecated HTML Table Attributes
The previously used HTML table attributes have been deprecated in HTML5. Get familiar with them, but don't use them in your codes:
Attribute | Purpose | Alternative |
---|---|---|
align | Defined the table alignment in relation to the surrounding text | CSS float |
width | Defined the table width | CSS width |
border | Set the table border | CSS border |
cellpadding | Defined the cell content and the cell wall | CSS padding |
cellspacing | Defined the space between cells | |
frame | Defined what should be visible outside the borders | |
rules | Defined what should be visible inside the borders | CSS border |
summary | Defined a summary for a table | |
bgcolor | Specified the background color for a table | CSS background-color |