mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-01 23:29:30 +08:00
68 lines
1.6 KiB
Plaintext
68 lines
1.6 KiB
Plaintext
// mixins for grid system
|
|
// ------------------------
|
|
.make-row(@gutter: @grid-gutter-width) {
|
|
position: relative;
|
|
margin-left: (@gutter / -2);
|
|
margin-right: (@gutter / -2);
|
|
height: auto;
|
|
&:extend(.clearfix all);
|
|
}
|
|
|
|
.make-grid-columns() {
|
|
.col(@index) {
|
|
@item: ~".col-@{index}, .col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}";
|
|
.col((@index + 1), @item);
|
|
}
|
|
.col(@index, @list) when (@index =< @grid-columns) {
|
|
@item: ~".col-@{index}, .col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}";
|
|
.col((@index + 1), ~"@{list}, @{item}");
|
|
}
|
|
.col(@index, @list) when (@index > @grid-columns) {
|
|
@{list} {
|
|
position: relative;
|
|
display: block;
|
|
float: left;
|
|
flex: 0 0 auto;
|
|
padding-left: (@grid-gutter-width / 2);
|
|
padding-right: (@grid-gutter-width / 2);
|
|
}
|
|
}
|
|
.col(1);
|
|
}
|
|
|
|
.loop-grid-columns(@index, @class) when (@index > 0) {
|
|
.col@{class}-@{index} {
|
|
display: block;
|
|
width: percentage((@index / @grid-columns));
|
|
}
|
|
.col@{class}-push-@{index} {
|
|
left: percentage((@index / @grid-columns));
|
|
}
|
|
.col@{class}-pull-@{index} {
|
|
right: percentage((@index / @grid-columns));
|
|
}
|
|
.col@{class}-offset-@{index} {
|
|
margin-left: percentage((@index / @grid-columns));
|
|
}
|
|
.col@{class}-order-@{index} {
|
|
order: @index;
|
|
}
|
|
.loop-grid-columns((@index - 1), @class);
|
|
}
|
|
|
|
.loop-grid-columns(@index, @class) when (@index = 0) {
|
|
.col@{class}-@{index} {
|
|
display: none;
|
|
}
|
|
.col-push-@{index} {
|
|
left: auto;
|
|
}
|
|
.col-pull-@{index} {
|
|
right: auto;
|
|
}
|
|
}
|
|
|
|
.make-grid(@class: ~'') {
|
|
.loop-grid-columns(@grid-columns, @class);
|
|
}
|