Reputation: 301
my problem is about positioning a div. i have a div with dynamic height, sometimes it is 600px and sometimes it's 300 and so on, let's call that div, div A. Now i want to put another div inside div A and want to position it always on the bottom right, let's call this div B.
I know one way with positioning div B relative and do stuff with bottom:xy but in this case it isn't working, because my div A changes dynamically it's height.
My question is, is this possible? Do i need Javascript for that?
Upvotes: 0
Views: 125
Reputation: 112
It's possible and i just made a simple example for you :
NOTE: I use a js script try to manipulate your dynamic width/height situations.
Upvotes: 0
Reputation: 26969
You can do it by using absolute position
<div class="d1">
<div class="d2"></div>
</div>
.d1{
position:relative;
height:350px; width:150px;
background-color:grey
}
.d2{
position:absolute;
bottom:0; right:0;
background-color:red;
height:60px; width:80px;
}
Demo here http://jsfiddle.net/aMdrr/
You can change the d1 div height to test the effect
Upvotes: 3