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
|
||||
// example : .grid-perso { @include grid(12); }
|
||||
@mixin grid($number:$number,$gutter:$gutter) {
|
||||
margin-left: -$gutter;
|
||||
& > * {
|
||||
width: calc(100% * 1 / #{$number} - #{$gutter} - .01px);
|
||||
margin-left: $gutter;
|
||||
}
|
||||
& > .#{$kna-namespace}flex-item-double {
|
||||
width: calc(100% * 2 / #{$number} - #{$gutter});
|
||||
|
@ -139,14 +141,18 @@
|
|||
// Sass mixins for *unequal* columns grid container
|
||||
// example : .grid-perso { @include uneven-grid(2, 1); }
|
||||
@mixin uneven-grid($left:$left, $right:$right, $gutter:$gutter) {
|
||||
& > *:nth-child(odd) {
|
||||
margin-left: -$gutter;
|
||||
> * {
|
||||
margin-left: $gutter;
|
||||
&:nth-child(odd) {
|
||||
$size: ($left / ($left + $right)) * 100%;
|
||||
width: calc(#{$size} - #{$gutter});
|
||||
}
|
||||
& > *:nth-child(even) {
|
||||
&:nth-child(even) {
|
||||
$size: ($right / ($left + $right)) * 100%;
|
||||
width: calc(#{$size} - #{$gutter});
|
||||
}
|
||||
}
|
||||
@media (max-width: $small-screen) {
|
||||
& > *:nth-child(n) {
|
||||
width: calc(100% - #{$gutter});
|
||||
|
|
Loading…
Reference in a new issue