To give a post a different styling in the loop (2 posts)

  1. smoothie.vemund
    Posted 2 years ago #


    I'm making an online magazine. Check here for live preview of my blog. What I want to do, is give for exemple one post a border around, and another a grey background. I'm not talking about the single.php file, but the frontpage itself. Is there any way I can do this?

  2. Peter_L
    Posted 2 years ago #

    Just those 2 styles?

    You could use the css3 selectors :odd and :even.

    But you'll also need a fallback for other browsers that don't know css3. This fallback has to be using classes. There probably is a simple way of doing this using a wordpress filter but i'm not sure how.
    You might also use javascript to add .odd and .even classes but i would advise against that.

Topic Closed

This topic has been closed to new replies.

About this Topic