mirror of
https://github.com/papercss/papercss
synced 2024-06-10 18:03:27 +02:00
120 lines
2.9 KiB
Plaintext
120 lines
2.9 KiB
Plaintext
@columnNames: col, sm, md, lg;
|
|
@columnSizes: 0px, 768px, 992px, 1200px;
|
|
|
|
@numberOfColumns: 12;
|
|
|
|
.make-column-class(@name, @size, @n, @p: 1) when (@p =< @n) {
|
|
@percent: (@p * 100% / @n);
|
|
.@{name}-@{p} {
|
|
.col-size(@percent);
|
|
}
|
|
|
|
.make-column-class(@name, @size, @n, (@p + 1));
|
|
}
|
|
|
|
.make-column-classes(@n, @j: 1) when (@j =< length(@columnNames)) {
|
|
@columnName: extract(@columnNames, @j);
|
|
@columnSize: extract(@columnSizes, @j);
|
|
@media (min-width: @columnSize) {
|
|
.make-column-class(@columnName, @columnSize, @n);
|
|
}
|
|
|
|
.make-column-classes(@n, @j + 1);
|
|
}
|
|
|
|
.center-all() {
|
|
-webkit-align-items: center;
|
|
align-items: center;
|
|
-webkit-justify-content: center;
|
|
justify-content: center;
|
|
}
|
|
.col-size(@percent) {
|
|
-webkit-box-flex: 0;
|
|
-webkit-flex: 0 0 @percent;
|
|
-ms-flex: 0 0 @percent;
|
|
flex: 0 0 @percent;
|
|
max-width: @percent;
|
|
}
|
|
.row {
|
|
margin-right: auto;
|
|
margin-left: auto;
|
|
display: -webkit-box;
|
|
display: -webkit-flex;
|
|
display: -ms-flexbox;
|
|
display: flex;
|
|
-webkit-box-orient: horizontal;
|
|
-webkit-box-direction: normal;
|
|
-webkit-flex-flow: row wrap;
|
|
-ms-flex-flow: row wrap;
|
|
flex-flow: row wrap;
|
|
margin-bottom: 1rem;
|
|
&.flex-right {
|
|
-webkit-box-pack: end;
|
|
-webkit-justify-content: flex-end;
|
|
-ms-flex-pack: end;
|
|
justify-content: flex-end;
|
|
}
|
|
&.flex-center {
|
|
-webkit-box-pack: center;
|
|
-webkit-justify-content: center;
|
|
-ms-flex-pack: center;
|
|
justify-content: center;
|
|
}
|
|
&.flex-edges {
|
|
-webkit-box-pack: justify;
|
|
-webkit-justify-content: space-between;
|
|
-ms-flex-pack: justify;
|
|
justify-content: space-between;
|
|
}
|
|
&.flex-spaces {
|
|
-webkit-justify-content: space-around;
|
|
-ms-flex-pack: distribute;
|
|
justify-content: space-around;
|
|
}
|
|
&.flex-top {
|
|
-webkit-box-align: start;
|
|
-webkit-align-items: flex-start;
|
|
-ms-flex-align: start;
|
|
align-items: flex-start;
|
|
}
|
|
&.flex-middle {
|
|
-webkit-box-align: center;
|
|
-webkit-align-items: center;
|
|
-ms-flex-align: center;
|
|
align-items: center;
|
|
}
|
|
&.flex-bottom {
|
|
-webkit-box-align: end;
|
|
-webkit-align-items: flex-end;
|
|
-ms-flex-align: end;
|
|
align-items: flex-end;
|
|
}
|
|
}
|
|
.col {
|
|
padding: 1rem;
|
|
@media (max-width: 767px) {
|
|
// Stack for mobile
|
|
.col-size(100%);
|
|
}
|
|
}
|
|
.col-fill {
|
|
width: auto;
|
|
flex: 1 1 0px;
|
|
}
|
|
.make-column-classes(@numberOfColumns);
|
|
.align-top {
|
|
-webkit-align-self: flex-start;
|
|
-ms-flex-item-align: start;
|
|
align-self: flex-start;
|
|
}
|
|
.align-middle {
|
|
-webkit-align-self: center;
|
|
-ms-flex-item-align: center;
|
|
-ms-grid-row-align: center;
|
|
align-self: center;
|
|
}
|
|
.align-bottom {
|
|
-webkit-align-self: flex-end;
|
|
-ms-flex-item-align: end;
|
|
align-self: flex-end;
|
|
} |