Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Redmak Posted August 20, 2021 Posted August 20, 2021 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. 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).
christopher-w Posted August 22, 2021 Posted August 22, 2021 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.
Redmak Posted August 22, 2021 Author Posted August 22, 2021 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.
Genestoy Posted August 23, 2021 Posted August 23, 2021 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; }
Redmak Posted August 23, 2021 Author Posted August 23, 2021 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
Recommended Posts