- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I am trying to style multiple tables on the same web page on the salient themed wordpress site. The tables are called via javascript link. I was able to style all the table the same way but want different styles on each table. Any help will be greatly appreciated. Here is the code I use to style the tables:
If you can’t put classes on the tables, maybe you can use the nth-of-type
selector to target the different tables in CSS, like:
:nth-of-type(0n+2) table tr:nth-child(odd) {
background-color: salmon;
}
I am able to make classes but unsure how to link them to any particular table. Can anyone explain?
I meant in the HTML, set a class-name on the different tables, like doing <table class="table table-purple">
and <table class="table table-yellow">
and so on.
After that target them in CSS. Like:
.table-yellow tr:nth-child(odd) {
background-color: yellow;
}
Have you access to this, or are you using some kind of plugin with javascript? If you don’t have access to the templates, then go with my last answer.