Senkusha Member Licensed customer Sep 20, 2026 #1 I'm wanting to dress up my tables, make them more readable. Is there an easy way to add even/odd color background for rows in a table? I'm sure this is probably controlled through CSS, maybe in extra.less?
I'm wanting to dress up my tables, make them more readable. Is there an easy way to add even/odd color background for rows in a table? I'm sure this is probably controlled through CSS, maybe in extra.less?
Solution Mr Lucky Sep 21, 2026 Sorry this: CSS: tr:nth-child(even) td {background-color: silver!important} Or for both even and odd tr:nth-child(even) td {background-color: silver!important} tr:nth-child(odd) td {background-color: blue!important}
Sorry this: CSS: tr:nth-child(even) td {background-color: silver!important} Or for both even and odd tr:nth-child(even) td {background-color: silver!important} tr:nth-child(odd) td {background-color: blue!important}
Mr Lucky Well-known member Licensed customer Sep 20, 2026 #2 Try this in extra.less. Adapt to suit. CSS: tr:nth-child(even) {background-color: silver;} Last edited: Sep 21, 2026 Upvote 0 Downvote
Senkusha Member Licensed customer Sep 20, 2026 #3 I added that to my extra.less, even included the missing closing brace, but I don't see any differences. Upvote 0 Downvote
I added that to my extra.less, even included the missing closing brace, but I don't see any differences.
CTS Well-known member Licensed customer Sep 21, 2026 #4 I asked Google AI and it said this: untested. Code: /* Target standard HTML tables or custom bbTables */ table, .bbTable table { tr:nth-child(odd) { background-color: @xf-contentAltBg; /* Odd row background */ } tr:nth-child(even) { background-color: @xf-pageBackground; /* Even row background */ } } Upvote 0 Downvote
I asked Google AI and it said this: untested. Code: /* Target standard HTML tables or custom bbTables */ table, .bbTable table { tr:nth-child(odd) { background-color: @xf-contentAltBg; /* Odd row background */ } tr:nth-child(even) { background-color: @xf-pageBackground; /* Even row background */ } }
Mr Lucky Well-known member Licensed customer Sep 21, 2026 #5 Sorry this: CSS: tr:nth-child(even) td {background-color: silver!important} Or for both even and odd tr:nth-child(even) td {background-color: silver!important} tr:nth-child(odd) td {background-color: blue!important} Last edited: Sep 21, 2026 Upvote 0 Downvote Solution
Sorry this: CSS: tr:nth-child(even) td {background-color: silver!important} Or for both even and odd tr:nth-child(even) td {background-color: silver!important} tr:nth-child(odd) td {background-color: blue!important}
Mr Lucky Well-known member Licensed customer Sep 21, 2026 #7 Senkusha said: That did the trick! Thank you! Click to expand... No problem happy to help. I knew but had forgotten that a row (tr) cannot have a background. Only a cell (or a table) can have a background. Upvote 0 Downvote
Senkusha said: That did the trick! Thank you! Click to expand... No problem happy to help. I knew but had forgotten that a row (tr) cannot have a background. Only a cell (or a table) can have a background.