HTML5 > Structures

Column in HTML5

How to specify column properties in HTML5?


By using <col> tag we can specify the column properties of table, each column with in a colgroup in HTML5. <col> tag is used only when the values of each column are different.

  • tr - To create a Row
  • td - To create a column
    <style>
        .colClass
        {
            background-color:red;
            font-size:x-large;
        }
    </style>

<body>
    <table>
        <colgroup>
            <col />
            <col class="colClass" />            
        </colgroup>
        <tr>
            <td>1</td>
            <td style="color:yellow;background-color:green;">2</td>
        </tr>
        <tr>
            <td>2</td>
            <td>3</td>
        </tr>
        <tr>
            <td>3</td>
            <td>4</td>
        </tr>
    </table>
</body>
In the above code snippet we can notice that the value of each column is different.
OUTPUT

Notice that in the above output each column is indicated by different colour and different value.
 Views: 4732 | Post Order: 70



Write for us






Hosting Recommendations