I use bootstrap. Table td is padding with 8px by bootstrap. But I just need 2px padding, So I use this style sheets to make the layout.
.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
padding: 2px;
}
I want to know how can I select the td more easily? I'm more curiously about this way one layer a step.
.table > (thead, tbody, tfoot) > (td , th)
Or this: Can the * match many layers?
.table > * > td
Here is the snippet, any help will be appreciated. Thanks in advance!
table, td {
border: 1px solid;
}
<link rel="stylesheet" href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css">
<html>
<head>
<style>
.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
padding: 1px;
}
</style>
</head>
<div class="container">
<table class="table">
<thead>
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
</thead>
<tbody>
<tr><td>1</td><td>2</td><td>3</td></tr>
<tr><td>4</td><td>5</td><td>6</td></tr>
</tbody>
</table>
</div>
</html>