td padding: 2px; : td padding « Tags « HTML / CSS






td padding: 2px;

    

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
    <head>
        <title>:first-child</title>
<style type='text/css'>
body {
    font-size: 12px sans-serif;
}
table {
    background: slateblue;
    color: #fff;
    width: 100%;
    border-collapse: collapse;
    border: 1px solid mediumslateblue;
}
td {
    border: 1px solid darkslateblue;
    padding: 2px;
}
th {
    background: lightsteelblue;
    color: darkslateblue;
    font-size: 18px;
    text-align: left;
}
table tbody tr:first-child td {
    background: mediumslateblue;
}
</style>
    </head>
    <body>
        <h1>Discography</h1>
        <table>
            <thead>
                <tr>
                    <th>Album</th>
                    <th>Year</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>A</td>
                    <td>March 1963</td>
                </tr>
                <tr>
                    <td>B</td>
                    <td>November 1963</td>
                </tr>
                <tr>
                    <td>C</td>
                    <td>July 1964</td>
                </tr>
                <tr>
                    <td>D</td>
                    <td>December 1964</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>

   
    
    
    
  








Related examples in the same category

1.Table cell padding
2.Cell padding
3.Set margin and padding for td tag
4.td padding-left: 11px;
5.td padding-right: 11px;
6.td padding: 0; margin: 0;
7.td padding: 5px;
8.td padding: 7px;
9.td, th, caption padding: 5px;
10.td padding:20px;