2014-02-01 18:37:56 +01:00
|
|
|
/* ---------------------------------- */
|
2015-03-05 11:29:06 +01:00
|
|
|
/* ==Grids */
|
2014-02-01 18:37:56 +01:00
|
|
|
/* ---------------------------------- */
|
|
|
|
|
2015-07-02 09:31:17 +02:00
|
|
|
// WARNING : KNACSS grids are flexbox based and only supported by IE10+ and Android4.4+
|
2015-03-05 11:29:06 +01:00
|
|
|
// Tuto : http://www.alsacreations.com/tuto/lire/1659-une-grille-responsive-avec-flexbox-et-LESS.html
|
|
|
|
// Demo : http://codepen.io/raphaelgoetter/pen/zxBMLW
|
2013-09-12 11:59:14 +02:00
|
|
|
|
2015-03-05 11:29:06 +01:00
|
|
|
// Usage in vanilla CSS:
|
|
|
|
// - <div class="grid-4"> for an equal fourth columns grid container
|
|
|
|
// - <div class="grid-2-1"> for an uneven columns grid container
|
2014-05-07 10:45:47 +02:00
|
|
|
|
2015-03-05 11:29:06 +01:00
|
|
|
// Usage with preprocessors : if you're using LESS, you can config grids variables :
|
2015-03-06 09:53:19 +01:00
|
|
|
// n = number of columns (default = 4)
|
|
|
|
// example : .grid-perso { .grid(12); }
|
2015-03-05 11:29:06 +01:00
|
|
|
// ... or uneven grids :
|
2015-03-06 09:53:19 +01:00
|
|
|
// left = left ratio column (default = 2) / right = right ratio column (default = 1)
|
|
|
|
// example : .grid-perso { .uneven-grid(2, 1); }
|
2014-05-07 10:45:47 +02:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
[class*="@{kna-namespace}grid-"] {
|
2015-07-01 13:47:48 +02:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
margin-left: -@gutter;
|
2015-03-06 09:53:19 +01:00
|
|
|
}
|
2015-03-05 11:29:06 +01:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
[class*="@{kna-namespace}grid-"] > * {
|
2015-07-01 13:47:48 +02:00
|
|
|
flex: 0 0 auto;
|
|
|
|
display: block; /* IE fix */
|
|
|
|
width: ~'calc(100% * 1 / @{number} - @{gutter} - .01px)';
|
|
|
|
margin-left: @gutter;
|
2015-03-06 09:53:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// LESS mixins for *equal* columns grid container
|
|
|
|
// example : .grid-perso { .grid(12); }
|
2015-05-05 23:22:30 +02:00
|
|
|
.grid(@number:@number, @gutter:@gutter) {
|
2015-03-30 12:24:54 +02:00
|
|
|
& > * {
|
2015-07-01 13:47:48 +02:00
|
|
|
width: ~'calc(100% * 1 / @{number} - @{gutter} - .01px)';
|
|
|
|
}
|
|
|
|
& > .@{kna-namespace}flex-item-double {
|
|
|
|
width: ~'calc(100% * 2 / @{number} - @{gutter} - .01px)';
|
|
|
|
}
|
|
|
|
@media (min-width: (@tiny-screen + 1)) and (max-width: @small-screen) {
|
|
|
|
& > * {
|
|
|
|
width: ~'calc(100% * 1 / 2 - @{gutter} - .01px)';
|
|
|
|
}
|
|
|
|
& > .@{kna-namespace}flex-item-double {
|
|
|
|
width: ~'calc(100% - @{gutter} - .01px)';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@media (max-width: @tiny-screen) {
|
|
|
|
& > * {
|
|
|
|
width: ~'calc(100% - @{gutter} - .01px)';
|
|
|
|
}
|
|
|
|
& > .@{kna-namespace}flex-item-double {
|
|
|
|
width: ~'calc(100% - @{gutter} - .01px)';
|
|
|
|
}
|
|
|
|
}
|
2014-05-03 11:08:29 +02:00
|
|
|
}
|
2014-05-07 10:45:47 +02:00
|
|
|
|
2015-03-06 09:53:19 +01:00
|
|
|
// Examples : will be compiled in CSS
|
2014-05-19 10:46:39 +02:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-2 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.grid(2);
|
2013-09-12 11:59:14 +02:00
|
|
|
}
|
2014-05-07 10:45:47 +02:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-3 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.grid(3);
|
2013-09-26 20:38:02 +02:00
|
|
|
}
|
2014-05-07 10:45:47 +02:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-4 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.grid(4);
|
2014-05-07 10:45:47 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-5 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.grid(5);
|
2014-05-07 10:45:47 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-6 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.grid(6);
|
2014-05-07 10:45:47 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-7 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.grid(7);
|
2014-05-07 10:45:47 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-8 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.grid(8);
|
2014-05-07 10:45:47 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-10 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.grid(10);
|
2014-05-07 10:45:47 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-12 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.grid(12);
|
2014-05-07 10:45:47 +02:00
|
|
|
}
|
|
|
|
|
2015-03-05 11:29:06 +01:00
|
|
|
// LESS mixins for *unequal* columns grid container
|
2015-03-06 09:53:19 +01:00
|
|
|
// example : .grid-perso { .uneven-grid(2, 1); }
|
2015-05-05 23:22:30 +02:00
|
|
|
.uneven-grid(@left:@left, @right:@right, @gutter:@gutter) {
|
2015-07-01 13:47:48 +02:00
|
|
|
& > *:nth-child(odd) {
|
|
|
|
@size: (@left / (@left + @right)) * 100%;
|
|
|
|
width: ~'calc(@{size} - @{gutter})';
|
|
|
|
}
|
|
|
|
& > *:nth-child(even) {
|
|
|
|
@size: (@right / (@left + @right)) * 100%;
|
|
|
|
width: ~'calc(@{size} - @{gutter})';
|
|
|
|
}
|
|
|
|
@media (max-width: @tiny-screen) {
|
|
|
|
& > *:nth-child(n) {
|
|
|
|
width: ~'calc(100% - @{gutter})';
|
|
|
|
}
|
|
|
|
}
|
2014-05-07 10:45:47 +02:00
|
|
|
}
|
2013-09-12 11:59:14 +02:00
|
|
|
|
2014-02-01 18:37:56 +01:00
|
|
|
|
2015-03-06 09:53:19 +01:00
|
|
|
// Examples : will be compiled in CSS
|
2014-02-01 18:37:56 +01:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-2-1 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.uneven-grid(2,1);
|
2014-02-01 18:37:56 +01:00
|
|
|
}
|
2014-05-07 10:45:47 +02:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-1-2 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.uneven-grid(1,2);
|
2014-02-01 18:37:56 +01:00
|
|
|
}
|
2014-05-07 10:45:47 +02:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-3-1 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.uneven-grid(3,1);
|
2014-05-03 11:08:29 +02:00
|
|
|
}
|
2014-05-07 10:45:47 +02:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-1-3 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.uneven-grid(1,3);
|
2014-05-03 11:08:29 +02:00
|
|
|
}
|
2014-05-07 10:45:47 +02:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-3-2 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.uneven-grid(3,2);
|
2014-05-03 11:08:29 +02:00
|
|
|
}
|
2014-05-07 10:45:47 +02:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-2-3 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.uneven-grid(2,3);
|
2014-02-01 18:37:56 +01:00
|
|
|
}
|
2014-05-07 10:45:47 +02:00
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-4-1 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.uneven-grid(4,1);
|
2014-05-07 10:45:47 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 23:22:30 +02:00
|
|
|
.@{kna-namespace}grid-1-4 {
|
2015-07-01 13:47:48 +02:00
|
|
|
.uneven-grid(1,4);
|
2015-05-05 23:22:30 +02:00
|
|
|
}
|