XF 2.0 alternate background color on widget

Nicolas FR

Well-known member
Hello,

How to get alternative background color on New Posts and New Threads widget ?
I mean to get each message row or thread row with an alternate background color.

Is it possible ?
 
Last edited:
You can try something like so (the widget id will be different on your site)

CSS:
[data-widget-id="9"]
{
    li.block-row:nth-child(odd)
    {
        background: #f00;
    }
    li.block-row:nth-child(even)
    {
        background: #00f;
    }
}

1539782206934.webp
 
Yeah same concept pretty much, this should work,

Less:
[data-template="forum_list"]
{
    .block-container .node:nth-child(odd)
    {
        background: #e9f5fd;
        border-top: none;
    }
    .block-container .node:nth-child(even)
    {
        background: #fff;
        border-top: none;
    }

}
 
Hey @Steve F, it's me, again ! ✌

What is the code for alternate background for new-post widget but used in what's new page ? Widget with plain thread infos
Each line is not made with block-row anymore but with structItem-cell

I tried all possibilities but... :(
Thanks in advance
 
Yeah same concept pretty much, this should work,

Less:
[data-template="forum_list"]
{
    .block-container .node:nth-child(odd)
    {
        background: #e9f5fd;
        border-top: none;
    }
    .block-container .node:nth-child(even)
    {
        background: #fff;
        border-top: none;
    }

}

Copied this to extra.css and it works great. What's the code for doing the same thing to the thread list within a sub-forum?
 
Top Bottom