CSS Why my code don't work? -
html
<div id="galerie"> <div id="stanga"> </div> </div> css
#galerie { margin-top: 5%; width: 974px; height: 500px; margin-left:auto; margin-right:auto; background-color:yellow; } #stanga { width: 50px; height: 50px; background-color: red; margin-top:20px; margin-left: 0px; } i want red square have margin-top:10px yellow container. http://jsfiddle.net/97fzwuxh/16/
margins collapse design, inner margin have effect on outer div.
add overflow:auto #galerie style
or
add padding:1px #galerie style
your problem called adjoining
two margins adjoinin of box , top margin of first in-flow child, if both belong vertically-adjacent box edges
Comments
Post a Comment