Forums

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

Home Forums CSS Background top center with min-width

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

    I have a top image background with 900px width and for more that 960px screens is perfectly centered with:

    background-image: url('images/header-bg.png');
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center top;
    background-color: transparent;

    The problem is when I’m is lower, I want to stop centering and get the image “stuck”, like the rest of the contents inside that div. I tried min-width but it doesn’t work.

    #91249
    XaviJr
    Participant

    Nevermind. Already accomplished!

    #91260
    dmwj80
    Member

    can you tell how you have fixed this, i am having a similar issue.

    #91277
    XaviJr
    Participant

    Sure, here’s my solution:

    background-image: url('images/header-bg.png');
    background-repeat: no-repeat;
    background-position: center top;
    background-color: transparent;
    position:absolute;
    left:50%;
    margin-left:-450px;
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.