0

Sorry if the title was confusing, I'm having a bit of trouble explaining here. I'm working on a theme for my site, and I'm using a slightly modified version of a custom comments template found here. The style I have in mind for comments is this:

  1. Top Level comment 1

    1. Child comment 1

    2. child comment 2

    3. Child comment 3

  2. Top level comment 2

  3. Top level comment 3

AKA I want the child comments to be even/odd, but I want the main thread comments all to be alike. My problem is that when a new comment is added at the top, the child comments get offset. So instead of being the above, it turns into:

  1. Top Level comment 1

    1. Child comment 1

    2. child comment 2

    3. Child comment 3

  2. Top level comment 2

  3. Top level comment 3

Which is undesirable. How can I make it so the child even/odd classes are unaffected by new main comments?

Thanks.

1 Answer 1

0

Remove .even & .odd class styles from style.css and use CSS psudo classes.

.comment:nth-child(2n) {
    your styles for even
}

.comment:nth-child(2n+1) {
    your styles for odd
}
1
  • I have tried that, but I can't figure out how to make the nth-child carry over to all of the child comments. They end up affecting every element that is a child, and not just the <article> tags I want changed.
    – Aaa
    Sep 7, 2014 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.