Skip to content
Related Articles

Related Articles

Design a table using table tag and its attributes

View Discussion
Improve Article
Save Article
  • Last Updated : 14 Dec, 2020

In this article, we will create a table using HTML. To create this table, we must know the tags required to create the table. At first, we will create the structure of the table and we will use attributes to design the table.

Approach: To create the table we have to use the <table> tag and we will use attributes of the <table> tag to design the table. The attributes that we will use to design the table are: cellspacing, cellpadding, border, bg color, etc.


<!DOCTYPE html>
<body bgcolor="pink">
    <table bgcolor="silver" align="center" 
        border="5" cellspacing="5" 
        <tr bgcolor="purple">
            <caption align="top">
                <h2 style="color: #ff3300;">
            <th bgcolor="magenta">train number</th>
            <th bgcolor="magenta">departure</th>
            <th bgcolor="magenta">arrival</th>
            <th bgcolor="magenta">category</th>
            <td>shatabdi express</td>


So using the attributes of the table tag, we can design the table.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!