Improve grid and uneven-grid mixins
This commit is contained in:
parent
4a5dd0f5bd
commit
6483baf8e8
1 changed files with 13 additions and 7 deletions
|
@ -44,8 +44,10 @@
|
||||||
// Sass mixins for *equal* columns grid container
|
// Sass mixins for *equal* columns grid container
|
||||||
// example : .grid-perso { @include grid(12); }
|
// example : .grid-perso { @include grid(12); }
|
||||||
@mixin grid($number:$number,$gutter:$gutter) {
|
@mixin grid($number:$number,$gutter:$gutter) {
|
||||||
|
margin-left: -$gutter;
|
||||||
& > * {
|
& > * {
|
||||||
width: calc(100% * 1 / #{$number} - #{$gutter} - .01px);
|
width: calc(100% * 1 / #{$number} - #{$gutter} - .01px);
|
||||||
|
margin-left: $gutter;
|
||||||
}
|
}
|
||||||
& > .#{$kna-namespace}flex-item-double {
|
& > .#{$kna-namespace}flex-item-double {
|
||||||
width: calc(100% * 2 / #{$number} - #{$gutter});
|
width: calc(100% * 2 / #{$number} - #{$gutter});
|
||||||
|
@ -139,13 +141,17 @@
|
||||||
// Sass mixins for *unequal* columns grid container
|
// Sass mixins for *unequal* columns grid container
|
||||||
// example : .grid-perso { @include uneven-grid(2, 1); }
|
// example : .grid-perso { @include uneven-grid(2, 1); }
|
||||||
@mixin uneven-grid($left:$left, $right:$right, $gutter:$gutter) {
|
@mixin uneven-grid($left:$left, $right:$right, $gutter:$gutter) {
|
||||||
& > *:nth-child(odd) {
|
margin-left: -$gutter;
|
||||||
$size: ($left / ($left + $right)) * 100%;
|
> * {
|
||||||
width: calc(#{$size} - #{$gutter});
|
margin-left: $gutter;
|
||||||
}
|
&:nth-child(odd) {
|
||||||
& > *:nth-child(even) {
|
$size: ($left / ($left + $right)) * 100%;
|
||||||
$size: ($right / ($left + $right)) * 100%;
|
width: calc(#{$size} - #{$gutter});
|
||||||
width: calc(#{$size} - #{$gutter});
|
}
|
||||||
|
&:nth-child(even) {
|
||||||
|
$size: ($right / ($left + $right)) * 100%;
|
||||||
|
width: calc(#{$size} - #{$gutter});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media (max-width: $small-screen) {
|
@media (max-width: $small-screen) {
|
||||||
& > *:nth-child(n) {
|
& > *:nth-child(n) {
|
||||||
|
|
Loading…
Reference in a new issue