How to use HTML Table Tag Attributes In HTML

In this approach, we are using the border attribute within the <table> tag to specify the width of the border around the table and its cells. By setting the value to 3, we create a border with a thickness of 3 pixels.

Syntax:

<table border="3">

Example: The below example uses HTML Table Tag Attributes to create a table border in HTML.

HTML
<!DOCTYPE html>
<html>

<head>
    <title>Example 1</title>
</head>

<body>
    <h3>Using HTML Table Tag Attributes</h3>
    <table border="3">
        <tr>
            <th>Name</th>
            <th>Subject</th>
            <th>Marks</th>
        </tr>
        <tr>
            <td>w3wiki</td>
            <td>HTML</td>
            <td>82</td>
        </tr>
    </table>
</body>

</html>

Output:

Table border using table tag attributes.

How to Create Table Border in HTML ?

In HTML, we can represent the data in the tabular format by using the <table> tag. We can customize the table by creating a border with different widths and colors.

Below are the approaches to create a Table Border in HTML:

Table of Content

  • Using HTML Table Tag Attributes
  • Using HTML Inline Styling

Similar Reads

Using HTML Table Tag Attributes

In this approach, we are using the border attribute within the

tag to specify the width of the border around the table and its cells. By setting the value to 3, we create a border with a thickness of 3 pixels....

Using HTML Inline Styling

In this approach, we are using inline styling