3

Look at this: http://jsfiddle.net/unimous/88uqJ/

<div id="d1">
    <div id="d2">
</div>
</div>

#d1 {
    height: 3000px;
    background-color: red;
}

#d2 {
    background-color: green;
    height: 40px;
    width: 40px;
    position: absolute;
    bottom: 0px;
}

I want to make div d2 appear at the bottom of d1, not the bottom of the screen.

Why position: absolute doesn't work here?

1
  • tl;dr Add #d1 { position:relative; } Commented Aug 19, 2013 at 16:21

1 Answer 1

5

Add position:relative to your d1 div

jsFiddle example

Absolutely positioned elements are positioned with respect to their closest positioned ancestor.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.