How to Create Table in HTML

·

2 min read

How to Create Table  in  HTML

Table formatting tag in html :

In html <table> table tag contains the total structure of table .Inside this Table there is <tr>,<td> and <th> tags by using this tag we create a table.

\=> <table>the whole table information is present inside the table open tag and close tag</table>

\=> <tr> --- Table row it creates empty rows which present inside the open and close tag </tr>

\=> <td>---Table data gives the data to the table rows either text or image inside open and close tags</td> which present inside the table .

\=> <th>--- Table heading gives the heading data to the table inside open and close tag </th>

Example :

<html>
  <head>
       <title> about creating tables in html</title>
  </head>
  <body>
     </table>
         <table border="1">
            <tr>
             <th>sno</th>
             <th>sname</th>
             </tr>
              <td> 1</td>
              <td> Ammu </td>
             </tr>
             </table>
  </body>
</html>

Attributes in table :

To give border to the table we use an attribute----> border="1" or "2"

To align text or table in middle point we use an attribute--> align ="center"

To merge rows inside the table we use an attribute--->row span="2" how many rows you want to merge you can give that number.

To merge columns inside the table we use an attribute--->colspan="3" how many columns you want to merge you can give that number.

Example :

<html>
  <head>
       <title> about creating tables in html</title>
  </head>
  <body>
      <table border="1">
    <tr>
     <th colspan="3">student</th>
    </tr>
        <tr>
         <td rowspan="3"> details</td>   
         <th align="center" clospan="1">sno</th>
         <th align="center" colspan="1">sname</th>
        </tr>
         <tr>         
          <td> 1</td>
          <td> Ammu </td>
         </tr>
         <tr>  
            <td>2</td>
            <td>theerdha</td>
        </tr>
         </table>
  </body>
</html>

Follow for more ….. thank u for visiting by blog.