Table in HTML : Code You Need to Know

HOW TO MAKE A TABLE IN HTML?

Table in HTML is considered within an element <table>. It is used to display data in a structured grid format, organized into rows and columns. This is particularly useful for presenting tabular data like schedules, financial reports, or product listings.
An HTML table is constructed using the following elements:
1. <table>: Defines the table itself.
2. <tr>: Represents a table row.
3. <th>: Defines a header cell in the table, typically used for column titles.
4. <td>: Defines a standard data cell in the table.

Detailed information about HTML

Table Attributes

  • Align: To align the table, the ALIGN attribute of the <⁣table> tag may be used. This can have values left, right, and center, indicating where the table should be placed.
  • Table Border: BORDER is an attribute of the table element, which specifies how wide a table border shall be BORDER=”0″ specifies no border at all. The default value for the BORDER attribute is 1. If you do not specify the value, the border will be one pixel wide. The attribute of BORDER=”value.”
  • Table Border Color: The BORDERCOLOR attribute is used to specify the color of the table’s border. The attribute of BORDERCOLOR is BORDERCOLOR=”colorname.”
  • Cellspacing and Cellpadding: To control the spacing in cells, use cellspacing and cellpadding attributes. Cellpadding refers to the inner margins of free space that each cell of a table has as its padded border. On the other hand, cellspacing refers to how space is left between each cell wall in a table.
  • Table Height and Width: You can also set the table’s height and width in terms of pixels and percentage of browser window. For instance, to set the width to 50% and height to 40% of the margins.
CODE
<html>
<head>
<title>Exam With Ai</title>
</head>
<body>
<table border="3">
<tr>
<th>Module 1</th>
<th>Module 2</th>
<th>Module 3</th>
<th>Module 4</th>
</tr>
<tr>
<td>Information Technology Tools and Network Basics</td>
<td>Web Designing and Publishing</td>
<td>Programming and Problem Solving through Python</td>
<td>Internet of Things and its Applications</td>
</tr>
</table>
</body>
<html>
OUTPUT
Table in HTML
Share your love
Sleepy Expert
Sleepy Expert
Articles: 26

Leave a Reply

Your email address will not be published. Required fields are marked *