Guidance portal

World of Guidance and Education

Insert Table

This chapter has been broken into two sub topic as follows

  • Introduction to html table
  • How to create table?

Lets start the introduction.

Introduction to html table.

Tables are used to design and format the text on webpages. Tables helps to ensure that alignement of text written, is as per requirements. Nearly all websites have table (hidden tables ) on their webpages. Both hidden and visible tabels are used while formatting the text (content) of webpages. Hidden tables are more useful while the requirement is to make a sequence in content of the page.

How to create html table

The tag for inserting table is <table>. Complete syntax along with explanation of terms is shown below

    <table>
    <tr>
    <td>your content</td>
    </tr>
    </table>

<table> will start the syntax of table. Now you have to determine the number of rows and columns for the table. <tr>is used to insert the row. You have to start the row tag and then under the row have to set the number of columns using <td> tag.Close each column's tag after writting your content for that column with </td>. Then close the row using closing tag of row i.e. </tr>. If you have to insert another row then repeat the same process again i.e. open column tag, write your content, close column tag and then row tag. In this way complete your whole table and in the very end close the table using </table>.

For example to insert the table with two rows and three columns, the code will be as follows.

    <table width="545" border="2">
    <tr>
    <td>you first cell content</td>
    <td>you first cell content</td>
    <td>you first cell content</td>
    </tr>
    <tr>
    <td>you first cell content</td>
    <td>you first cell content</td>
    <td>you first cell content</td>
    </tr>
    </table>

Note

<tr>tag is used to insert rows and <td> tag is used to insert columns.

The table on browser will looks like as follows.

    Browser view

 

How to change background of table is explained in Chapter 14: Formatted Table

 

 

comments powered by Disqus