Class 1 Class 2 Class 3 Class 4 Class 5 Class 6 Class 7 Class 8

Table in HTML

Share Now

Tables in HTML are used to organize and display data in rows and columns, making information easy to read and understand. They are commonly used for showing structured data.

Table in HTML

In HTML, a table is used to display data in a structured format using rows and columns. A table is useful when we want to present data in a tabular format, like a pricing list, marks details, etc. You can create a table using a <table> tag.

  • <table> : starts the table
  • <tr> : table row
  • <th> : table header (bold, centered by default)
  • <td> : table data (normal cell)

Example,

<table>
        <tr>
            <th>Name</th>
            <th>Subject</th>
            <th>Marks</th>
        </tr>
        <tr>
            <td>Anurag</td>
            <td>Math</td>
            <td>95</td>
        </tr>
    	</table>

Table Attributes

  • ALIGN: Align helps to align the position, like left, right, or center.
  • BGCOLOR=”color”: Bgcolor helps set the background color of the table.
  • BORDER=”value”: It is used to set the thickness of the table border in pixels; here, 0 means no border.
  • CELLPADDING=”value”: It helps to create space between the cell border and content. The default cellpadding is 1.
  • CELLSPACING=”value”: Cell spacing creates a space between cells; by default it is 2px.
  • HEIGHT=”height”: It is used to set the table height; this height you can set using pixels or percentages.
  • WIDTH=”width”: It is used to set the table width; this width you can use using pixels or percentages.
  • COLS=”n”: This attribute defines the number of virtual columns or equal width.
  • HSPACE=”value”: This attribute is helpful for creating a margin around the table.
  • VSPACE=”value”: This attribute helps to create vertical margin around the table.

Disclaimer: We have provide you with the accurate handout of “Table in HTML“. If you feel that there is any error or mistake, please contact me at anuraganand2017@gmail.com. The above study material present on our websites is for education purpose, not our copyrights.

Images and content shown above are the property of individual organisations and are used here for reference purposes only. To make it easy to understand, some of the content and images are generated by AI and cross-checked by the teachers.

cbseskilleducation.com

Leave a Comment