Skip to content

Instantly share code, notes, and snippets.

@SelenIT
Created February 23, 2012 19:26
Show Gist options
  • Save SelenIT/1894507 to your computer and use it in GitHub Desktop.
Save SelenIT/1894507 to your computer and use it in GitHub Desktop.
CSS2.1 8.3.1 Collapsing margins
/**
* CSS2.1 8.3.1 Collapsing margins
*/
div { margin: 50px; background: #000; color: #fff; }
p { margin: 80px 0; background: rgba(128,255,128,.3);}
span {
float: left;
background: rgba(255,255,192,.8);
color: green;
width: 90px;
height: 80px;
border: 1px solid #ccc;
margin: -1px 2px;
box-shadow: 0 0 1px rgba(255,255,192,.8);
}
.clear { clear: left; }
<div>
<p><span>Float в непустом блоке 1</span>Первый абзац</p>
<p style="margin-bottom:100px"><span>Float из пустого блока 2</span></p>
<p><span>Float в непустом блоке 3</span>Третий абзац</p>
</div>
{"view":"separate","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment