Forums

  • # January 21, 2013 at 8:44 am

    I’m using a wordpress theme and I want to apply a background image to a div just on homepage.

    How can I do this ?

    # January 21, 2013 at 8:52 am

    Depending on which page you are on, the body will have different classes, assuming your WordPress Theme calls the function body_class.

    The homepage has the class “home”, so you can use that to target the div, since my understanding of your question means that you don’t have other ways to differentiate this div from others.

    # January 21, 2013 at 7:45 pm

    Thank you for your suggestion!
    And I assume I have to write a php funtction like “if body has homepage class apply that css property”
    Can you help me with this ?

    # January 21, 2013 at 8:26 pm

    .home .yourdivclassorid { background: #fff url(yourimg.png) no-repeat top center; }

    as an example

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag