Created
April 12, 2012 21:55
-
-
Save tpryan/2371301 to your computer and use it in GitHub Desktop.
CSS Regions Example
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
#content { | |
-webkit-flow: 'foo'; | |
-webkit-flow-into: foo; | |
} | |
.region { | |
background-color: white; | |
-webkit-box-sizing: border-box; | |
content: -webkit-from-flow('foo'); | |
-webkit-flow-from: foo; | |
margin: 20px 0 20px 0; | |
height: auto; | |
overflow: hidden; | |
padding: 10px 10px 10px 0; | |
width: 48%; | |
float: left; | |
} | |
#region1{ | |
float: none; | |
width: 100%; | |
height: 240px; | |
margin-top: 0; | |
} | |
#region2{ | |
height: 500px; | |
float: right; | |
margin-left: 0; | |
} | |
#region3{ | |
height: 500px; | |
margin-right: 0; | |
} | |
#region4{ | |
float: none; | |
width: 100%; | |
height: 2000px; | |
overflow: visible; | |
margin-bottom: 0px; | |
} |
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
<script type="text/javascript"> | |
document.addEventListener('DOMContentLoaded', function() { | |
if (document.webkitGetFlowByName){ | |
var displayText = '<div id="region1" class="region"></div>'+ | |
'<hr />'+ | |
'<div id="region3" class="region"></div>'+ | |
'<div id="region2" class="region"></div>'+ | |
'<hr />'+ | |
'<div id="region4" class="region"></div>'; | |
var displayDiv = document.createElement('div'); | |
displayDiv.innerHTML = displayText; | |
document.querySelector('body').appendChild(displayDiv); | |
} | |
}); | |
</script> |
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
<article id="content"> | |
... Content here .... | |
</article> | |
<div id="display"> | |
<div id="region1" class="region"></div> | |
<hr /> | |
<div id="region3" class="region"></div> | |
<div id="region2" class="region"></div> | |
<hr /> | |
<div id="region4" class="region"></div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment