Change background from main page, but not the rest of pages.

  • Author
  • #512449


    can I change the background from my “home” or post page, but not from the rest of the pages?

    I´d really like to make something different for the presentation page, and let all the other ones unchanged. but when I change the background using .entry-content every page changes too.

    I appreciate it very much.


    The blog I need help with is


    If you look at the source for your home page vs other pages, you will see that for the body section on the home page it says,

    <body class="home blog">

    while on your bio page for example it says

    <body class=”page page-id-34 page-template page-template-onecolumn-page-php”>`

    You should be able to put a different background on each page really by defining it under the appropriate class in the CSS.


    Oops, missed the opening backtick on the second code example above.


    Actually, maybe I misread. Are you talking about a different background for the content area vs the main body area, which is now light grey?


    hi! and thanks for the answers.

    yes, I´m talking about the grey area, with the text over it. maybe I didn´t explain it right.


    You know, I expect it may be possible using a child selector, but the only one I know of with enough experience to do it, or say for sure, would be hallluke. He comes into the forums randomly and helps with CSS issues. Perhaps he will see this thread and respond.


    ok. thanks. then I´ll wait for halluke, after all he´s given to me every single css line in my blog!

    so the thing would be to be able to change the background (the grey area) for the main page, but not in the rest of the pages. being able to insert a different color, or a picture or padding, …but only taking effect in that main page.

    thanks a lot.


    Yeah, I think so. I really need to read up on and understand child selectors. They are very powerful (with pitfalls as well). Also, they aren’t supported by older browsers such as IE6 or earlier, so that can be a problem. There are still too many people out there using IE6. They really need to upgrade for security reasons at the very least.


    good info to take into account, because I want all those people (I have some known people too) to be able to enter my website… so maybe I´ll think twice if this thing means explorer 6 users won´t be able to. I have explorer 6 in my old pc!

    thanks a lot.



    body.home #content {background-color:#aee;}

    This will take effect on your “home” blog pages, the first two in your main navigation links. It looks like you won’t need child selectors so it will work fine cross browser. If it does throw up any nasty side effects then let me know.


    Thanks Luke.


    it´s really simple and works great.
    one more time thanks luke

The topic ‘Change background from main page, but not the rest of pages.’ is closed to new replies.