Grow your CSS skills. Land your dream job.

Position div fixed relative to parent?

  • # July 10, 2009 at 11:31 pm

    i seem to notice that position: fixed is relative to whole body/html. can i position an element fixed relative to an element?

    markup is something like

    Code:

    wrapper is centered
    i want to position sidebar fixed relative to the wrapper/current position. so scrolling will only affect div#main

    Rob
    # July 11, 2009 at 2:00 am

    nope – fixed is always relative to the browser window :)

    If you want to do it inside a box, use absolute – but then it will scroll with teh box… lol

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

You must be logged in to reply to this topic.

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