Forums

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

Home Forums CSS How to center bg image?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #184920
    web_editor
    Participant

    I want to center the bg image (the red one). I try to put this background-position:center center; but its not working. Look here

    #184923
    __
    Participant

    That’s just a jpeg image.
    It’s not an HTML document or anything else you can style with CSS.

    codepen?

    #184932
    Paulie_D
    Member

    We can’t diagnose an image…perhaps you could show us the issue in a reduced case Codepen.io demo.

    #184934
    Scott
    Participant

    Remove that image entirely from wherever it is, re-size the image if you can to get a good size I usually stick with 1920×1080. Next set the image to the html of your website.

    html {
    background: url(yourimageurlhere) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    }

    This will center your image and also make it responsive at the same time. I think the issue is your trying to set an image held in a wrapper to the whole sites background.

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