XML style for table : table « XML « HTML / CSS






XML style for table

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="exercise17-1.css"?>
<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> K</td>
                <td> A</td>
                <td> 2</td>
            </tr>
        </tbody>
    </table>
</body>

body {
    display: block;
    margin: 13px;
}
table {
    display: table;
    width: 300px;
    caption-side: bottom;
    border: thin solid black;
    table-layout: fixed;
    border-spacing: 0;
}
colgroup {
    display: table-column-group;    
}
col {
    display: table-column;
}
thead {
    display: table-header-group; 
}
tbody {
    display: table-row-group;
}
tr {
    display: table-row;
}
th, td {
    display: table-cell;
    border: thin solid black;
    text-align: center;
    font-weight: bold;
    overflow: hidden;
}
th {
    background: lightgrey;
}
td {
    vertical-align: top;
}
caption {
    display: table-caption;
    font-size: 90%;
    text-align: right;
}
td, th, caption {
    padding: 5px;
}

 








Related examples in the same category

1.table layout
2.Style for xml table