Table & the Border attribute

The Tutorial illustrates an example from Table and the Border attribute. In this Tutorial, the code explains to create a table and the border with a specified attribute.

Table & the Border attribute

     

The Tutorial illustrates an example from Table and the Border attribute. In this Tutorial, the code explains to create a table and the border with a specified attribute.

Understand with Example

To create a table in HTML, the <table> tag is used. In the <table> tag, the value of the border has to be specified. A table is sub-divided into table rows(tr) and then into table data(td).

<tr>: This is used to define a row in the table.

<td>: This is used to define a cell in your table.

The code is saved with .html extension and paste the path of html code into url of your supporting browser.


<table border="1">

<tr>
<td>data1</td>
<td>data2</td>
</tr>

<tr>
<td>data3</td>
<td>data4</td>
</tr>
<tr>
<td>data5</td>
<td>data6</td>

</table>

On execution, the web browser will evaluate the above code as:

data1 data2
data3 data4
data5 data6

Download

Ads