KNACSS/less/02-grids.less
2014-05-04 15:30:21 +02:00

137 lines
No EOL
3.1 KiB
Text

@import "00-config";
/* ---------------------------------- */
/* ==classic grids */
/* .. use it when gutter size matters */
/* ---------------------------------- */
/* grids inspired from SUIT https://github.com/suitcss/suit */
.grid { /* overall container of grids */
overflow: hidden;
}
.grid > * { /* global styles for direct child ex. .grid3 */
display: block;
padding: 0;
margin-left: -@gutter; /* gutter value */
text-align: left;
}
.grid > * > * { /* global styles for each "cell" */
display: inline-block;
padding-left: @gutter; /* gutter value */
margin-left: 0;
vertical-align: top;
}
/* whitespace fixing for modern browsers including IE9+ */
:root .grid {
font-size: 0;
}
:root .grid > * > * {
font-size: @base-font-size; /* fallback for Opera Mini */
font-size: unit((@base-font-size / 10), rem);
}
/* Opera hack */
.opera:-o-prefocus,
.grid > * {
word-spacing: -0.43em;
}
.grid2 > * {width: 50%;}
.grid3 > * {width: 33.333%;}
.grid4 > * {width: 25%;}
.grid5 > * {width: 20%;}
.grid6 > * {width: 16.667%;}
.grid8 > * {width: 12.5%;}
.grid10 > * {width: 10%;}
.grid12 > * {width: 8.333%;}
/* unequal grids (1-2, 2-1, 1-3 and 3-1) for 2 blocks */
.grid2-1 > *:first-child,
.grid1-2 > * + * { width: 66.666%; }
.grid1-2 > *:first-child,
.grid2-1 > * + * { width: 33.333%; }
.grid1-3 > *:first-child,
.grid3-1 > * + * { width: 25%; }
.grid3-1 > *:first-child,
.grid1-3 > * + * { width: 75%; }
/* Responsiv-o-matic */
@media (max-width: @large-screen) {
.grid5 > *,
.grid6 > *,
.grid8 > *,
.grid10 > *,
.grid12 > * {width: 33.333%}
}
@media (max-width: @small-screen) {
.grid3 > *,
.grid4 > *,
.grid5 > *,
.grid6 > *,
.grid8 > *,
.grid10 > *,
.grid12 > * {width: 50%}
}
@media (max-width: @tiny-screen) {
.grid > * > * {width: 100% !important}
}
/* ---------------------------------- */
/* ==autogrids */
/* .. to automatically justify blocs */
/* ---------------------------------- */
/* Demo : http://codepen.io/raphaelgoetter/pen/Kqehf */
[class*="autogrid"] { /* container of autogrids */
text-align: justify;
}
[class*="autogrid"]:after {
content: "";
display: inline-block;
width: 100%;
}
[class*="autogrid"] > * {
display: inline-block;
vertical-align: top;
text-align: left;
}
/* whitespace fixing for modern browsers including IE9+ */
:root [class*="autogrid"] {
font-size: 0;
}
:root [class*="autogrid"] > * {
font-size: @base-font-size; /* fallback for Opera Mini */
font-size: unit((@base-font-size / 10), rem);
}
/* Opera hack */
[class*="autogrid"]:-o-prefocus {
word-spacing: -0.43em;
}
.autogrid2 > * {width: 49%}
.autogrid3 > * {width: 32%}
.autogrid4 > * {width: 23.6%}
.autogrid5 > * {width: 19%}
.autogrid6 > * {width: 15%}
.autogrid8 > * {width: 10.8%}
.autogrid10 > * {width: 9%}
.autogrid12 > * {width: 6.4%}
@media (max-width: @large-screen) {
.autogrid5 > *,
.autogrid6 > *,
.autogrid8 > *,
.autogrid10 > *,
.autogrid12 > * {width: 32%}
}
@media (max-width: @small-screen) {
.autogrid5 > *,
.autogrid6 > *,
.autogrid8 > *,
.autogrid10 > *,
.autogrid12 > * {width: 49%}
}
@media (max-width: @tiny-screen) {
[class*="autogrid"] > * {width: 100%}
}