When a static element is given a negative margin on the top/left, it pulls the element in that specified direction.
div.box{
height:260px;
width:400px;
border:1px solid black;
}
div.left{
float:left;
height:30px;
width:400px;
border:1px solid red;
}
div.right{
float:left;
height:30px;
width:400px;
border:4px solid green;
margin-left:-300px;
text-align:right;
}
<div class="box">
<div class="left">left</div>
<div class="right">right</div>
</div>
1.div.left and div.right are in different space.
2.div.right was put left with 300px width.
Now to change the margin-left in css of div.right into -600px.
div.box{
height:260px;
width:400px;
border:1px solid black;
}
div.left{
float:left;
height:30px;
width:400px;
border:1px solid red;
}
div.right{
float:left;
height:30px;
width:400px;
border:4px solid green;
margin-left:-600px;
text-align:right;
}
<div class="box">
<div class="left">left</div>
<div class="right">right</div>
</div>
Why div.right and div.left overlap each other when negative margin enlarge into 600px?
What result in this appearance?
How negative margin width affect float ?