Grow your CSS skills. Land your dream job.

overflow-x on body causes background to not scroll

  • # November 22, 2012 at 4:26 pm

    If I set overflow-x:hidden on the body/html tags, my background image will not scroll, it acts as if it’s fixed.

    Can anyone explain why this happens??

    # November 23, 2012 at 12:52 am

    Because you are telling the viewport not to show anything beyond what it already is. In effect you are freezing the initial window…if it can’t scroll the background doesn’t need to move.

    # November 23, 2012 at 9:10 am

    So even if it’s overflow-x:hidden, if you are still able to scroll vertically (y-axis), the background is told to stay put?

    Weird, but thanks for the insight.

    # November 23, 2012 at 9:12 am

    I didn’t realise that your background extended downwards.

    Do you have a link we can look at?

    # November 26, 2012 at 12:37 pm

    I have fixed the issue with some javascript, because the design I was given required me to use a bit of JS to work with the overflow of divs and elements.

    I will see if I can set up a smaller test-case because I am very curious of this behavior.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".