Table header with border : th border « Tags « HTML / CSS

Table header with border


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
        <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;
                My favorite movies.
                <col id='movie' />
                <col id='cast' />
                <col id='genre' />
                <col id='year' />
                    <th> movie            </th>
                    <th> stars            </th>
                    <th> genre            </th>
                    <th> year             </th>
                    <td> B</td>
                    <td> J</td>
                    <td> C</td>
                    <td> 2</td>
                    <td> T</td>
                    <td> E</td>
                    <td> A</td>
                    <td> 2</td>
                    <td> T</td>
                    <td> K</td>
                    <td> A</td>
                    <td> 2</td>


Related examples in the same category

1.Set table header border to be 1px solid black, its width to 6em
2.Set table border for table header border-left: 1px solid #f4f4f4; border-bottom: solid 2px #fff; border-left: 1px solid #EDC9C9; border-bottom: 1px solid #FFF; border-left: 1px solid #fff; border: 1px solid black; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #CDC1A7;, tfoot td border: thin solid black;text-align: center;font-weight: bold;
13.thead th {border-bottom: 1px solid #333; text-align: center; font-weight: bold;}[scope="col"] {border-bottom: 1px solid gray;}