I have a css code I want to improve. Actually this code was copy-pasted from Chrome styles inspector. But I'm stuck with trying to simplify it into one rule using nesting to get "clean" styles:
.table > thead > tr > th, .table > thead > tr > td,
.table > tbody > tr > th, .table > tbody > tr > td,
.table > tfoot > tr > th, .table > tfoot > tr > td {
border-top: 1px solid #000;
}
Is there a way to make it simplier?
In table we find <th>
and <td>
in <thead>
, <tbody>
and <tfoot>
and in above css all the things are targeted so why not simply use this
.table th, .table td{
border-top: 1px solid #000;
}
This will also target all <th>
and <td>
in table.
You can omit middle part as you are selecting all parts from table
.table th,
.table td {
border-top: 1px solid #000;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With