Jump to content

Alternating post colors in a topic?


Recommended Posts

I have added back the alternating row colors for the topic lists (ipsDataList_zebra) in my forum, but I noticed that does not work on the article class for posts, like in this thread.

SNAG-0021.png.8b9cfb47639508030db4e3b72429bed4.png.03d49104fc58b3508f2ffe663d73e4d0.png

Is there a magic trick I can do to alternate posts in a thread between color1 and color2 ?

I remember with IPB 3.x we actually had CSS class for post1 and post2 with the color set, and I think "special" post colors like moderated/answered simply overrode it.

I've been looking at postContainer, but I can't see how I can set a post1 and post2 color that also lets the other classes override this (like highlighted/moderated etc).

Link to comment
Share on other sites

I don’t know where exactly you are referring to, but the standard way of targeting odd and even rows is with CSS nth child selector  

See here for example (towards end of page) 

CSS :nth-child() Selector

You can combine this with :not(something) to exclude those elements with existing class assignments  - thus not interfering with highlighted/moderated etc.

 

 

 

 

Link to comment
Share on other sites

35 minutes ago, christopher-w said:

I don’t know where exactly you are referring to, but the standard way of targeting odd and even rows is with CSS nth child selector  

See here for example (towards end of page) 

CSS :nth-child() Selector

You can combine this with :not(something) to exclude those elements with existing class assignments  - thus not interfering with highlighted/moderated etc.

Hi Christopher, thanks for replying. I am basically looking to alternate the color of posts in topics like we can do for forum rows and topic lists already.

Link to comment
Share on other sites

Is this what you want put in custom.css (change the background color to whatever you want)--

/**
*adds the zebra stripes between topics
*/
.ipsResponsive_pull .ipsDataList .ipsDataItem:not( .ipsDataItem_selected ):not( .ipsModerated ):not( .ipsDataItem_new ):not( .ipsDataItem_success ):not( .ipsDataItem_warning ):not( .ipsDataItem_error ):not( .ipsDataItem_info ):not( .ipsDataItem_status ):nth-child(even) {
	background: #F7F7F7;
}

 

Link to comment
Share on other sites

16 hours ago, Genestoy said:

Is this what you want put in custom.css (change the background color to whatever you want)--

/**
*adds the zebra stripes between topics
*/
.ipsResponsive_pull .ipsDataList .ipsDataItem:not( .ipsDataItem_selected ):not( .ipsModerated ):not( .ipsDataItem_new ):not( .ipsDataItem_success ):not( .ipsDataItem_warning ):not( .ipsDataItem_error ):not( .ipsDataItem_info ):not( .ipsDataItem_status ):nth-child(even) {
	background: #F7F7F7;
}

 

Thanks, I already have something like that in custom.css

 

/* Zebra striping */
/* Need to exclude all the other color options here, since they should override the zebra stripes */
.ipsDataList.ipsDataList_zebra .ipsDataItem:not( .ipsDataItem_selected ):not( .ipsModerated ):not( .ipsDataItem_new ):not( .ipsDataItem_success ):not( .ipsDataItem_warning ):not( .ipsDataItem_error ):not( .ipsDataItem_info ):not( .ipsDataItem_status ):nth-child(even) {
	background: #edf1f4;
}

when I replaced it with yours, forums and topic lists alternated okay, but not posts in topics, they remained the same color.

Example thread with lots of posts https://www.neowin.net/forum/topic/1409174-microsoft-should-stop-with-this-charade-and-make-windows-11-a-paid-upgrade

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...