Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  permalink
    So I just have a simple CSS-related question. Absolute positioning is supposed to be based on the parents element, right? So if I have something like this:

    <div id="left">
    <div id="leftleft">Left</div>
    <div id="leftright">Right</div>
    </div>

    CSS:

    #leftleft {
    width: 200px;
    background-color: blue;
    }

    #leftright {
    width: 100px;
    background-color: green;
    position: absolute;
    left: 200px;
    }

    Shouldn't #leftright be NEXT to #leftleft since its parent element is #left? Instead it goes left 200px, but underneath #leftleft.

    Sorry if this sounds a bit confusing, let me know if I need to clarify.

    Thanks in advance!
  2.  permalink
    Oh to add to this, if I swtich the DIVs to this, it seems to work the way I would think that it should:

    <div id="left">
    <div id="leftright">Right</div>
    <div id="leftleft">Left</div>
    </div>
  3.  permalink
    Do you have "position: relative;" set on your #left DIV?
  4.  permalink
    I didn't, but I just added that, and it didn't seem to change anything...
    • CommentAuthorbdote
    • CommentTimeApr 20th 2006
     permalink
    Hi ActiveTuning -- position relative for leftright fixes it
Add your comments
    Username Password
  • Format comments as (Help)