masonry-layout
Version:
Cascading grid layout library
128 lines (96 loc) • 1.75 kB
CSS
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: sans-serif;
}
.container {
background: #EEE;
width: 180px;
margin-bottom: 20px;
position: relative;
}
.item {
width: 60px;
height: 30px;
float: left;
border: 1px solid;
background: #09F;
}
.item.w2 { width: 120px; }
.item.w3 { width: 180px; }
.item.h2 { height: 50px; }
.item.h3 { height: 70px; }
.item.h4 { height: 90px; }
.item.h5 { height: 110px; }
.stamp {
background: red;
opacity: 0.75;
position: absolute;
border: 1px solid;
}
/* ---- gutter ---- */
#gutter {
width: 220px;
}
#gutter .item.w2 { width: 140px; }
/* ---- stamp ---- */
.has-stamp .item { width: 45px; }
/* stout, in the middle */
.has-stamp .stamp1 {
width: 40px;
height: 30px;
}
/* really wide */
.has-stamp .stamp2 {
width: 200px;
height: 20px;
}
#stamp-top-left .stamp1 {
left: 70px;
top: 10px;
}
#stamp-top-left .stamp2 {
left: -5px;
top: 0;
}
#stamp-column-width-multiple .stamp1 {
width: 90px;
left: 45px;
top: 0;
}
#stamp-bottom-right .stamp1 {
right: 70px;
bottom: 10px;
}
#stamp-bottom-right .stamp2 {
right: -5px;
bottom: 0;
}
/* ---- fit width ---- */
#fit-width {
width: 160px;
background: #CCC;
}
#fit-width .container {
margin: 0 auto;
}
/* ---- ---- */
#zero-column-width .hidden {
display: none;
}
/* ---- element-sizing ---- */
#element-sizing {
width: 181px;
}
#element-sizing .item,
#element-sizing .grid-sizer { width: 20%; }
#element-sizing .item.w2 { width: 40%; }
/* ---- pixel-rounding ---- */
#pixel-rounding {
width: 170px;
}
#pixel-rounding .item { width: 28.667%; }
#pixel-rounding .gutter-sizer { width: 7%; }