Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-06-12 17:31:08

newnoise
Member
Registered: 2011-02-24
Posts: 35

Possibility to display articles in article_list differently?

Hey,

is there any possibility to give articles in an article_list different styles?
I would like to use a different css class for the first, third, fith … article as for the second, fourth … article.

Thanks
noise

Offline

#2 2011-06-12 18:19:55

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,545
Website

Re: Possibility to display articles in article_list differently?

Yes:

  • In more modern browsers, you don’t need a class at all, you can use the css selector “:nth_child”:http://css-tricks.com/how-nth-child-works/.
  • Here’s a variant using txp’s in-built txp:variable to add odd/even zebra-striping using classes.
  • … and there’s a plugin zem_nth you can also use to add classes.

There are probably other ways too…


TXP Builders – finely-crafted code, design and txp

Offline

#3 2011-06-12 18:55:05

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: Possibility to display articles in article_list differently?

Hello Noise,

Everything that Jakob said, plus you can supplement the CSS3 selectors like nth_child with Selectivizr to take care of Internet Explorer which doesn’t support it. You can use Selectivizr in conjunction with one of the javascript libraries like, jQuery, Mootools etc. It’s easy to set up for nth_child and it’s well documented.

Last edited by joebaich (2011-06-13 00:55:33)

Offline

#4 2011-06-12 23:58:38

newnoise
Member
Registered: 2011-02-24
Posts: 35

Re: Possibility to display articles in article_list differently?

Thanks a lot you guys!

Offline

Board footer

Powered by FluxBB