CSS: Styling Every Other Element
There are a lot of times where you will want to automatically style every other element slightly differently, for example, in a table, to make it more legible. Here’s how.
tr {
background:#eee;
}
tr:nth-child(odd) {
background:#ddd;
}
The :nth-child(odd) property will target every other item of the element you have selected. Here is a working sample.
Comments
Recent Work
Basalt
basalt.softwareFree desktop AI Chat client, designed for developers and businesses. Unlocks advanced model settings only available in the API. Includes quality of life features like custom syntax highlighting.
BidBear
bidbear.ioBidbear is a report automation tool. It downloads Amazon Seller and Advertising reports, daily, to a private database. It then merges and formats the data into beautiful, on demand, exportable performance reports.