Reputation: 1668
I tried to position a arrow
div in the edge of floated div right
, so i given absolute position to arrow
and left to 0.
I know absolute position won't be in the static flow and it is different from others. even thought it should obey the left value according to their parent, isn't it?
Why in the js the arrow
is not placed at the border of right
div rather it placing in the outer div
HTML
<div id="wrapper">
<div id="right">
<div id="arrow">
arr
</div>
</div>
</div>
css
#wrapper{
width:500px;
height:500px;
border:2px solid green;
}
#right {
float:right;
width:250px;
height:250px;
border:2px solid green;
}
#arrow {
position:absolute;
background-color:blue;
color:white;
left:0;
}
Upvotes: 0
Views: 197
Reputation: 795
You have to do position: relative; on its parent with id="right".
Upvotes: 1
Reputation: 3560
I changed #arrow to
right:0;
instead of left.
and added position:relative; to the #right.
Upvotes: 0
Reputation: 5340
#right {
...
position:relative;
}
See this: http://jsfiddle.net/3tAnA/1/
Upvotes: 0