Introduction to HTML Tables

Henna Singh
2 min readMar 10, 2022

--

#BuildTogether Day 32/100

Today was a great day =D It started with talking to my favorite person in the world ❤ and then moved on to productive tasks and ended with me confirming my place at Martial Arts Academy ;) ohh yes, I love Kung Fu :D

Today, I am back to HTML. I managed to crack the error I was stuck at for a long time in the Book Log application, but I still have some pieces to go 😬

Tables

An HTML table is created with thetable tag. The elements of the table are placed inside this tag and two important ones are:

  • the <tr> tag that creates a table row;
  • the <td> tag that creates table cells.

Table Header

The <th> tag can be used to create a table header cell for rows or columns. The text inside this tag is bold and centered.

Caption

In addition to table headers, there is a way to add a caption to the whole table. Use the <caption> tag, which is usually added right after the <table> tag

Table Borders

By default, the table and its cells have no visible borders, but they can be set using the border attribute. Only positive numbers are valid.

The border settings automatically apply to all the cells in the table.

Setting a border using an HTML attribute is not always a good idea, It’s good practice to set a border for table elements using CSS

A Codepen including all table elements:

If you wanna follow “My journey of 100 Days”, please feel free to give it a read at MongoDB Community Forums.

--

--

Henna Singh
Henna Singh

Written by Henna Singh

Technical Speaker and an aspiring writer with avid addiction to gadgets, meet-up groups, and paper crafts. Currently doing Full Stack Diploma at Code Institute

No responses yet