Skip to content
Related Articles

Related Articles

How to Create Time-Table schedule using HTML ?
  • Difficulty Level : Medium
  • Last Updated : 24 Aug, 2020
GeeksforGeeks - Summer Carnival Banner

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 <table> tag in HTML.

Steps to Create a Table:

  1. Create a <html> tag.
  2. Create a table using the tags <table></table>.
  3. Create rows in the table using <tr>This is the row tag</tr>.
  4. Insert the data into rows using <td> Table Data</td> tags.
  5. Close the table tag. 
  6. Close the html tag </html>.

This is the basic Time table created in HTML without the usage of font color and background colors.

Example:




<!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, back ground color, back ground image, etc. to the above Time table. The attributes that can be added to table are:

  1. align: Aligns left, right and center.
  2. border: Sets the border of a table(table border width)
  3. bgcolor: Sets the background color for a cell or whole table.
  4. colspan: Sets the number of columns to be spanned.
  5. rowspan: Sets the number of columns to be spanned.
  6. cellspacing: Creates space between the cells.
  7. cellpadding: Creates space within the cells.
  8. background: Sets the table background with an image.
  9. width: Sets width of the table.
  10. height: Sets height of the table.

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :