• Resolved tyco72

    (@tyco72)


    I am trying to combine more elements in the CSS block, to add a the background image only in a specific page.
    If I add a page ID to the code, only the first parameter is overtaken.
    Is it not the correct syntax or have I to write 2 separate CSS sets?

    body.page-id-9,
    .site-header.page-id-9 {
    background-image: url(“image url”);
    background-position: center center;
    background-size: cover;
    background-repeat: repeat;
    background-attachment: fixed;
    }

    With this code, the background of the header doesn’t change. If I enter only body,.site-header {
    it works correctly on all pages.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Leo

    (@leohsiang)

    Hi there,

    The .page-id-xx class is in the <body> tag so the selector should be like this:

    body.page-id-9,
    body.page-id-9 .site-header
    Thread Starter tyco72

    (@tyco72)

    Thank you very much for the fast reply, it works!
    I could extend it also to the .inside-article area:

    /*background image on a specific page*/
    body.page-id-9,
    body.page-id-9 .site-header,
    body.page-id-9 .inside-article {
    background-image: url(“url image”);
    background-position: center center;
    background-size: cover;
    background-repeat: repeat;
    background-attachment: fixed;
    }

    Strangely i see no difference if I set “background-repeat: no-repeat;” but since I need the repeating of the image, it’s ok:)

    • This reply was modified 4 years, 2 months ago by tyco72.
    Leo

    (@leohsiang)

    No problem ??

    Thread Starter tyco72

    (@tyco72)

    Solved

    Leo

    (@leohsiang)

    Awesome ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Combine elements in CSS to change background in a specific page’ is closed to new replies.