Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Hiding body background image on smaller screens?

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #167297
    jonahnaylor
    Participant

    Hi I am trying to use a media query for a responsive website to hide the body background image on smaller screens.

    Here is my css code:

    /———————————
    LAYOUT
    ———————————–
    /

    body{
    background-attachment: fixed;
    background-image: url(“./images/image_bg.jpg”);
    background-position: center top;
    background-repeat: no-repeat;
    }

    @media only screen and (max-width: 479px) and (min-width: 0px)
    body {
    background:none;
    }
    }

    Does anyone please know why this isn’t working or how to fix it? Thanks very much for any help.

    #167298
    Paulie_D
    Member

    This

    @media only screen and (max-width: 479px) and (min-width: 0px)
    body {
    background:none;
    }
    }
    

    should be this

    @media only screen and (max-width: 479px) {
          body {
            background:none;
           }
    }
    
    #167299
    jonahnaylor
    Participant

    Hi thanks for the help.

    For some reason that isn’t working either for me. Here is the link to the website:

    http://proofing.yorkcreative.co.uk/test.html

    Thanks again for helping with this.

    #167301
    jonahnaylor
    Participant

    Hi this is the image:

    http://proofing.yorkcreative.co.uk/assets/templates/1van1man/images/1van1man_bg.jpg

    I put the media query in straight after the standard css body {} section…

    #167303
    jonahnaylor
    Participant

    Apologies – it is in fact working! Must of been my cache. Thanks again!

    #167304
    Paulie_D
    Member

    It’s working in FF as far as I can see…and Chrome

    #167306
    jonahnaylor
    Participant

    Yes thanks very much for your help. That is great.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘CSS’ is closed to new topics and replies.