I have a single div in a page. Now, when I specify its position as absolute and give its margin-left == 20px:
I understand that. The div element should shift right by 20 px so that thee exists a margin 0f 20px between the div and the body.
Now when I provide margin of 20px from right side, shouldn't the whole div move towards right side with a gap of 20px from the body.
.container{
position: absolute;
background-color:gray;
margin-right: 50px;
height: 200px;
}
I know I can position the div giving values of left and right. But the real question is margin left works but margin-right doesnt! WHy is it so? Help appreciated!