Tables in HTML

 

Tables in HTML

We can create tables in html using table tag. In the <table> tag we use <tr> tag for rows and in the row to add data in the column we use <td> tag. To view the table boarders or other decoration we need to use css properties.


Example

<!DOCTYPE html>

<html>

<style>

table, th, td {

  border:1px solid black;

}

</style>

<body>


<h2>A basic HTML table</h2>

 

<table style="width:100%">

  <tr>

    <th>Company</th>

    <th>Contact</th>

    <th>Country</th>

  </tr>

  <tr>

    <td>Alfreds Futterkiste</td>

    <td>Maria Anders</td>

    <td>Germany</td>

  </tr>

  <tr>

    <td>Centro comercial Moctezuma</td>

    <td>Francisco Chang</td>

    <td>Mexico</td>

  </tr>

</table>

 

<p>To understand the example better, we have added borders to the table.</p>

 

</body>

</html>


We discuss about CSS and its properties in the next module. HTML completed if you have not read the before search them in the our blog.


Thank you 

Post a Comment

Previous Post Next Post