Skip to content

Instantly share code, notes, and snippets.

@SelenIT
Forked from anonymous/dabblet.css
Created February 24, 2012 20:28
Show Gist options
  • Save SelenIT/1903534 to your computer and use it in GitHub Desktop.
Save SelenIT/1903534 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,192,.2); }
span {
float: left;
background: rgba(255,255,127,.8);
color: green;
width: 90px;
height: 90px;
margin: 0 2px;
box-shadow: 0 0 1px rgba(255,255,192,.8);
}
.clear { clear: left; }
<div>
<p><span>Float в непустом блоке</span>Первый див</p>
<p><span>Float из пустого блока 1</span></p>
<p class="cflear"><span>Float из блока 2 (с клиренсом)</span></p>
<p><span>Float из пустого блока 3</span></p>
<p><span>Float из пустого блока 4</span></p>
</div>
<div>Второй див</div>
{"view":"split","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment