I want to highlight alternating rows within a collection to make it easier to read and to clearly distinguish where a new set of information begins. How do I do this?
Question
Question
Answer
SELECTED ANSWER
replied on August 20, 2018
•
Show version history
Something like the following would do the trick. In the example I added a custom class called "myCollection" to the target collection.
.myCollection div.form-q:nth-of-type(2n) { // replace this with whatever styling you want for your highlight background: red; }
"div.form-q:nth-of-type(2n)" will get you the alternating rows. If you want to drill down further you can add more selectors after that to target specific child elements. Try 2n + 1 of you want the highlight to start on the first row instead of the second row.
However, if you want to do this with a table, then you would need to use "tr" or something along those lines instead of ".form-q" in addition to some other changes.
Either way, I'd suggest right-clicking and inspecting the page to try out different settings and pick apart the page elements so you can fine-tune everything to your liking.
0
0