You are viewing limited content. For full access, please sign in.

Question

Question

highlight collection

asked on August 20, 2018

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?

0 0

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
replied on August 20, 2018

This worked great.

Thanks.

0 0

Replies

You are not allowed to reply in this post.
replied on August 20, 2018

Something like the following would do the trick. In the example I added a custom class called "myCollection" to the target collection.

.myCollection .form-q:nth-of-type(2n) {
  // replace this with whatever styling you want for your highlight
  background: red;
}

".form-q:nth-of-type(2n)" will get you the alternating rows. If you want to drill down further you can more selectors after that to target specific child elements.

If you mean a table, then you would need to us "tr" or something instead of ".form-q"

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.

You are not allowed to follow up in this post.

Sign in to reply to this post.