<back

Table in HTML


  • syntax:<table>...</table>
  • it is used to represent data in a tabular form.
  • sample table caption
    usually empty column head column head
    row head data box data box
    row head data box data box

    This is a simple table.


    Let me explain every box and its importance one by one

    sample table caption:
    -it have the details of what table will contain, one can read table caption and can come to know about table without fully going through it.
    -syntax: <caption>...</caption>
    usually empty:
    -it does not have any meaning to it. it is used when the table consists of row and column head both.
    -syntax: &npsb;
    column head:
    -it shows the topic which the entire column will follow.
    -syntax: <th scope="col">...</th>
    row head:
    -it shows the topic which the entire row will follow.
    -syntax:<th scope="row">...</th>
    data box:
    -yeah, you guessed it right. this contains the data for which the table is made.
    -syntax:<td>...</td>

    Cool things you can perform using table:


  • common row:
  • something like this. this is different.
    this is different.

    you can achieve this by setting the rowspan attribute to any number you want.

    in this case it was 2;

    syntax: <td rowspan="2">...</td>


  • common columns:
  • something like this.
    this is different. this is different.

    you can achieve this by setting the colspan attribute to any number you want.

    in this case it was 2;

    syntax: <td colspan="2">...</td>