Table header format : th « Tags « HTML / CSS






Table header format

     


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title> HTML tables </title>
        <style type='text/css'>
            table {
                width: 300px;
                caption-side: bottom;
                border: thin solid black;
                table-layout: fixed;
                border-spacing: 0;
                margin: 5px;
            }
            th, td {
                border: thin solid black;
                text-align: center;
                font-weight: bold;
                overflow: hidden;
            }
            th {
                background: lightgrey;
            }
            td {
                vertical-align: top;
            }
            caption {
                font-size: 90%;
                text-align: right;
            }
            td, th, caption {
                padding: 5px;
            }
        </style>        
    </head>
    <body>
        <table>
            <caption>
                Table
            </caption>
            <colgroup>
                <col id='movie' />
                <col id='cast' />
                <col id='genre' />
                <col id='year' />
            </colgroup>
            <thead>
                <tr>
                    <th> movie            </th>
                    <th> stars            </th>
                    <th> genre            </th>
                    <th> year             </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td> t</td>
                    <td> F</td>
                    <td> C</td>
                    <td> 2</td>
                </tr>
                <tr>
                    <td> t</td>
                    <td> F</td>
                    <td> A</td>
                    <td> 2</td>
                </tr>
                <tr>
                    <td> N</td>
                    <td> C</td>
                    <td> D</td>
                    <td> 2</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>

   
    
    
    
  








Related examples in the same category

1.'th' Example
2.'axis' Example
3.'scope' specifies the group of cells to which header information on the current cell refers
4.table header tag
5.thead is the first section of a table. It formats the table header area.
6.Basic table with th tag
7.Style for table header
8.Nested table header
9.Table header style
10.Table header column span
11.Table header and cell overflow hidden
12.Two level of table header
13.table header height: 50px;
14.Three row header
15.Grouped table header
16.Selecting cells in head
17.th height: 29px;
18.th width: 6em;
19.th colspan="2"
20.th, td overflow: hidden;