Open In App
Related Articles

How to Create Time-Table schedule using HTML ?

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

A Table is an arrangement of rows and columns. Anyone can create a table by knowing the basics of HTML(HyperText Markup Language). A table is defined by using the <table> tag in HTML.

Approach:

  • Create a <html> tag.
  • Create a table using the tags <table></table>.
  • Create rows in the table using <tr>This is the row tag</tr>.
  • Insert the data into rows using <td> Table Data</td> tags.
  • Close the table tag. 
  • Close the HTML tag </html>.

Example: In this example code, we have created a basic timetable in HTML without the usage of font color and background colors with the above-explained approach.

html

<!DOCTYPE html>
<html>
 
<body>
    <h1>TIME TABLE</h1>
    <table border="5" cellspacing="0" align="center">
        <!--<caption>Timetable</caption>-->
        <tr>
            <td align="center" height="50" width="100"><br>
                <b>Day/Period</b></br>
            </td>
            <td align="center" height="50" width="100">
                <b>I<br>9:30-10:20</b>
            </td>
            <td align="center" height="50" width="100">
                <b>II<br>10:20-11:10</b>
            </td>
            <td align="center" height="50" width="100">
                <b>III<br>11:10-12:00</b>
            </td>
            <td align="center" height="50" width="100">
                <b>12:00-12:40</b>
            </td>
            <td align="center" height="50" width="100">
                <b>IV<br>12:40-1:30</b>
            </td>
            <td align="center" height="50" width="100">
                <b>V<br>1:30-2:20</b>
            </td>
            <td align="center" height="50" width="100">
                <b>VI<br>2:20-3:10</b>
            </td>
            <td align="center" height="50" width="100">
                <b>VII<br>3:10-4:00</b>
            </td>
        </tr>
        <tr>
            <td align="center" height="50">
                <b>Monday</b>
            </td>
            <td align="center" height="50">Eng</td>
            <td align="center" height="50">Mat</td>
            <td align="center" height="50">Che</td>
            <td rowspan="6" align="center" height="50">
                <h2>L<br>U<br>N<br>C<br>H</h2>
            </td>
            <td colspan="3" align="center" height="50">LAB</td>
            <td align="center" height="50">Phy</td>
        </tr>
        <tr>
            <td align="center" height="50">
                <b>Tuesday</b>
            </td>
            <td colspan="3" align="center" height="50">LAB
            </td>
            <td align="center" height="50">Eng</td>
            <td align="center" height="50">Che</td>
            <td align="center" height="50">Mat</td>
            <td align="center" height="50">SPORTS</td>
        </tr>
        <tr>
            <td align="center" height="50">
                <b>Wednesday</b>
            </td>
            <td align="center" height="50">Mat</td>
            <td align="center" height="50">phy</td>
            <td align="center" height="50">Eng</td>
            <td align="center" height="50">Che</td>
            <td colspan="3" align="center" height="50">LIBRARY
            </td>
        </tr>
        <tr>
            <td align="center" height="50">
                <b>Thursday</b>
            </td>
            <td align="center" height="50">Phy</td>
            <td align="center" height="50">Eng</td>
            <td align="center" height="50">Che</td>
            <td colspan="3" align="center" height="50">LAB
            </td>
            <td align="center" height="50">Mat</td>
        </tr>
        <tr>
            <td align="center" height="50">
                <b>Friday</b>
            </td>
            <td colspan="3" align="center" height="50">LAB
            </td>
            <td align="center" height="50">Mat</td>
            <td align="center" height="50">Che</td>
            <td align="center" height="50">Eng</td>
            <td align="center" height="50">Phy</td>
        </tr>
        <tr>
            <td align="center" height="50">
                <b>Saturday</b>
            </td>
            <td align="center" height="50">Eng</td>
            <td align="center" height="50">Che</td>
            <td align="center" height="50">Mat</td>
            <td colspan="3" align="center" height="50">SEMINAR
            </td>
            <td align="center" height="50">SPORTS</td>
        </tr>
    </table>
</body>
 
</html>

                    

Output:

We can also add the styling elements such as font color, background color, background image, etc. to the above Time table. The attributes that can be added to the table are:

  • align: Aligns left, right, and center.
  • border: Sets the border of a table(table border width)
  • bgcolor: Sets the background color for a cell or whole table.
  • colspan: Sets the number of columns to be spanned.
  • rowspan: Sets the number of columns to be spanned.
  • cellspacing: Creates space between the cells.
  • cellpadding: Creates space within the cells.
  • background: Sets the table background with an image.
  • width: Sets the width of the table.
  • height: Sets the height of the table.

HTML is the foundation of webpages and is used for webpage development by structuring websites and web apps. You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.



Last Updated : 24 Nov, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads