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

Home Forums CSS Position div fixed relative to parent?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #25414

    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

    <div class="bbcode_code">
    <div class="bbcode_code_head">Code:</div>
    <div class="bbcode_code_body" style="white-space:pre"><div id="wrapper">
        <div id="main" />
        <div id="sidebar" />

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

    Rob MacKay

    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)
  • The forum ‘CSS’ is closed to new topics and replies.