How To Create Table In HTML - Tech Worthy Mind

In HTML we can use a table tag to create a table. By using the <TR> tag we can create a row on the web page and by using the <TD> tag we can enter the data on the table row.
In this article, we will look at how to create a table in HTML and I am sure that after reading this blog you will be able to create a table HTML.

How to create a Table In HTML 

As I discuss above that <table> tag is used to define a table in HTML. There are some other tags that we used to store data in a structured form are as follows:

  • <tr> tag : used to display table row.
  • <td> tag : used to display table data.
  • <th> tag : to create table heading.
  • <thead> tag : to create table head.
  • <tbody> tag : to create table body. 
To add a caption in the table we use the <caption> tag

Don't get panic after seeing these tags I will explain to you all the tags in a simple and easy form with examples.

col span Attribute

It is used to create cells spanning multiple columns.
<th colspan="2"> Harshit </th>

HTML table without border

We can create table in HTML without the border as well as using the border property.

 

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Table</title>
</head>

<body>
    <table>
        <tr>
            <th>Name</th>
            <th>Mob</th>
            <th>Gender</th>
            <th>Age</th>
        </tr>
        <tr>
            <td>Harshit</td>
            <td>9897154367</td>
            <td>Male</td>
            <td>50</td>
        </tr>
        <tr>
            <td>Harshit</td>
            <td>9897154367</td>
            <td>Male</td>
            <td>50</td>
        </tr>
        <tr>
            <td>Harshit</td>
            <td>9897154367</td>
            <td>Male</td>
            <td>50</td>
        </tr>
</body>

</html>
The result of following code will be:

How to create HTML table with border

We can do this task using border property in table tag also we can do the same using the CSS also. 

<table border="2px solid Black">
After perform changes in table tag our table look like this
Table In HTML
We can change the color of the border and size of the border. 

Conclusion: 

In this article we explained how to create a table in HTML and we also discussed how to create a row in HTML, how to enter data in a row, how to create a row title and more concepts that are used to create a table.

Comments

Popular posts from this blog

Remove Tools From Termux | How can I reopen the installed tool in termux? | TECH WORTHY MIND

How To Hack Wifi | Hack Wifi Password | TECH WORTH MIND