background image for each page

Discussion in 'HTML and CSS' started by prayercall, May 11, 2016.

  1. prayercall

    prayercall

    Joined:
    May 11, 2016
    Messages:
    1
    Likes Received:
    0
    Im having trouble adding a new background image for each webpage. Most content is repeatative except background image.

    Code (Text):
     
    body
    {
        margin:0; padding:0;  background-image:url('backgrounds/background.nyc.jpg'); background-size: cover;
        font-family: Tahoma;
    }
     
    I just want a new background image for each webpage instead of using more than one stylesheet
     
    prayercall, May 11, 2016
    #1
    1. Advertisements

  2. prayercall

    Exodus_AU

    Joined:
    May 8, 2016
    Messages:
    3
    Likes Received:
    0
    Hi,

    Create separate classes for the bg and add it to the body tag.

    Code (Text):

    .home-bg { background: url(images/home-bg.jpg) no-repeat center center fixed; }
    .about-bg { background: url(images/about.bg.jpg) no-repeat center center fixed; }
     
    HTML:

    <html>
        <body class="home-bg">
        </body>
    </html>
     
     
    Exodus_AU, May 16, 2016
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.