Last active
August 29, 2015 14:02
-
-
Save obenjiro/1239edb9489263e0fd8b to your computer and use it in GitHub Desktop.
fight magin collapsing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
** http://jsfiddle.net/hEDEK/1/ | |
** | |
** http://www.w3.org/TR/CSS21/box.html#collapsing-margins | |
*/ | |
.child { | |
background: red; | |
width: 30px; | |
height: 30px; | |
margin: 10px; | |
} | |
.wrapper { | |
/* pushing our child element to other block-formatting context */ | |
overflow: hidden; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="wrapper"><div class="child">1</div></div> | |
<div class="wrapper"><div class="child">2</div></div> | |
<div class="wrapper"><div class="child">3</div></div> | |
<div class="wrapper"><div class="child">4</div></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment