Last active
August 29, 2015 14:18
-
-
Save wadtech/5f616ac98354d409ba5e to your computer and use it in GitHub Desktop.
Nightmarish floaty layout thing: Doing this sort of layout gets me every time// source http://jsbin.com/natusu
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
<html> | |
<head> | |
<meta name="description" content="Doing this sort of layout gets me every time"> | |
<script src="//code.jquery.com/jquery-2.1.1.min.js"><\/script> | |
<meta charset="utf-8"> | |
<title>Nightmarish floaty layout thing</title> | |
</head> | |
<body> | |
<section> | |
<article class="twentyfive"></article> | |
<article class="twentyfive"></article> | |
<article class="twentyfive"></article> | |
<article class="twentyfive"></article> | |
</section> | |
<section> | |
<article class="twentyfive"></article> | |
<article class="twentyfive"></article> | |
<article class="sixteen"></article> | |
<article class="sixteen"></article> | |
<article class="sixteen"></article> | |
</section> | |
</body> | |
</html> |
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
section { | |
width: 100%; | |
height: 250px; | |
background: orange; | |
} | |
article { | |
background-color: aqua; | |
height: 100%; | |
float:left; | |
} | |
.twentyfive { | |
width: 25%; | |
} | |
.sixteen { | |
width: 16.667%; | |
} |
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
var articles = document.querySelectorAll('article'); | |
for (var i = 0; i < articles.length; ++i) { | |
articles[i].style['background-color'] = '#' + Math.floor(Math.random() * 16777215).toString(16); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment