grid+scss实现bootstrap栅格系统

grid + scss 20行代码实现 bootstrap 栅格系统

vscode插件

html文件的热加载
image.png
sass编译
image.png

栅格核心

style.scss

.row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
}

@media screen and (max-width:768px) {
  @import "./sm.scss";
}

@media screen and (min-width:768px) and (max-width:1000px) {
  @import "./md.scss";
}

@media screen and (min-width:1000px) {
  @import "./lg.scss";
}

sm.scss

@for $i from 1 through 12 {
  .col-md-#{$i} {
    grid-column: span #{$i};
  }
}

md.scss

@for $i from 1 through 12 {
  .col-md-#{$i} {
    grid-column: span #{$i};
  }
}

lg.scss

@for $i from 1 through 12 {
  .col-md-#{$i} {
    grid-column: span #{$i};
  }
}

完整程序

https://github.com/withwz/grid-with-grid…

转:
https://www.yuque.com/wuzhao/kb/bogxdw

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值