1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Is there a way to alternate the background color in thread listing?

Discussion in 'Styling and Customization Questions' started by Rom, Mar 17, 2016.

  1. Rom

    Rom Member

    Is there a way to alternate the background color in thread listing? For example, I would like every other thread to have a grayish background color instead of all white.. just to break up the solid white. Thanks for any help!
     

    Attached Files:

  2. Rom

    Rom Member

    uh oh.. I guess no @Brogan reply means not possible. :(
     
  3. Matthew S

    Matthew S Member

    @Brogan In the Styling FAQ in your signature, you list 17. How can I style alternate posts? Would it not be possible to use similar CSS to style alternate threads? I'm a rank beginner in CSS, so please forgive my awkward attempt. Would something like this be on the right track, or is it required to use template edits?

    Code:
    .discussionList:nth-child(odd) {
    background-color: @primaryLighter;
    }
    
    .discussionList:nth-child(even) {
    background-color: @primaryLight;
    }
    
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Posts have sequential IDs, threads don't, so it's not possible to use the same approach,
     
    Matthew S likes this.
  5. Matthew S

    Matthew S Member

    When I get an idea in my head, it's hard for me to let it go sometimes. ;)

    This code works on my test forum. Added to the end of EXTRA.css.

    Code:
    .discussionListItem:nth-child(odd) {
    background-color: @primaryLightest;
    }
    
    .discussionListItem:nth-child(even) {
    background-color: @primaryLighter;
    }
    
    alternatingthreadcolours.jpg
     

Share This Page