Creating a Table Using Html.

·

1 min read

Creating a Table Using Html.

Creating a table is the initial project of web development. A table can be created by using a tag such as: <table>, <tr>, <th>, <td> with some attributes i.e cellspacing, cellpadding, colspan, row span.

Let's create a Time Table for school.

<body>
    <h1>TIME TABLE</h1>
    <table border="2px" cellspacing="2px" cellpadding="8px">
        <tr> 
            <th>Sr.no</th>
            <th>MON</th>
            <th>TUE</th>
            <th>WED</th>
            <th>THU</th>
            <th>FRI</th>
            <th>SAT</th>
        </tr>


        <tr> 
            <td>1.</td>
            <td>English</td>
            <td>English</td>
            <td>English</td>
            <td>English</td>
            <td>English</td>
            <td>English</td>
        </tr>
        <tr>
            <td>2.</td>
            <td>Maths</td>
            <td>Science</td>
            <td>Maths</td>
            <td>Science</td>
            <td>Maths</td>
            <td>Science</td>
        </tr>
        <tr>
            <td colspan="7" align="center">BREAK</td>
        </tr>
        <tr>
            <td>3.</td>
            <td>PT</td>
            <td>Drawing</td>
            <td>PT</td>
            <td>Drawing</td>
            <td>PT</td>
            <td>Drawing</td>
        </tr>
        <tr>
            <td>4.</td>
            <td>Esports</td>
            <td>Esports</td>
            <td>Esports</td>
            <td>Esports</td>
            <td>Esports</td>
            <td>Esports</tdd
        </tr>
    </table>

Ignore the subjects that I have created randomly but try to understand the logic behind the space occupied by each cell. Hence, this is a common example of a Table in HTML. I hope that the concept of the Table tag in HTML and its associated attributes is now clear to you.