Created
March 9, 2013 19:25
-
-
Save maxhoffmann/5125405 to your computer and use it in GitHub Desktop.
Clearing floats with overflow: auto
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
/** | |
* Clearing floats with overflow: auto | |
*/ | |
.bg { | |
background: red; | |
} | |
.cf { | |
overflow: auto; | |
} | |
.left { | |
float: left; | |
height: 100px; | |
} | |
.right { | |
float: right; | |
height: 100px; | |
} | |
html { | |
font-family: sans-serif; | |
} |
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
<h2>You should see a red box if it works:</h2> | |
<div class="bg cf"> | |
<div class="left"></div> | |
<div class="right"></div> | |
</div> |
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
// alert('Hello world!'); |
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
{"view":"separate","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment