• I was wondering how you would alternate the background colors of a page in wordpress.

    So for an example page: the background would be white for say 500px down then grey for the next 500px then white again..and so on.

    Then for a different page the background would be orange for 300px down then blue for 300px down etc.

    If anyone knows how to do this it would be greatly appreciated!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You wrap one set of content in one wrapper, then another in another wrapper. You then style each wrapper with a different background.
    E.g:

    <div class="wrapper black">
     <div class="container">
      <h2> Lorem </h2>
     </div>
    </div>
    
    <div class="wrapper white">
     <div class="container">
      <h2> Ipsum </h2>
     </div>
    </div>

    Illustrated with CSS at CSSDesk: http://cssdesk.com/aBduj .

    how you would alternate the background colors of a page in wordpress.

    In the same way that you would for any site – using the CSS background property and a two-color background image. You can change the background image and characteristics on a per page basis by targeting your CSS using the classes generated by the WordPress body_class() function.

    Thread Starter KevinS3

    (@kevins3)

    Awesome, thanks so much!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Alternating background colors of a page’ is closed to new replies.