CSS: margin-right and absolute positioning -
i have single div in page. now, when specify position absolute , give margin-left == 20px:
i understand that. div element should shift right 20 px thee exists margin 0f 20px between div , body.
now when provide margin of 20px right side, shouldn't whole div move towards right side gap of 20px body.
.container{ position: absolute; background-color:gray; margin-right: 50px; height: 200px; }
i know can position div giving values of left , right. real question margin left works margin-right doesnt! why so? appreciated!
its not margin-right
looking right
please see fiddle update: jsfiddle right
and if want sit @ bottom of screen add bottom
try updated fiddle: jsfiddle bottom
margin-right
not work because add margin
div area itself, while right
position value.
if @ box model shows margin added to. margin used give box space other objects around itself.
Comments
Post a Comment