响应式系统 发表于 2018-04-29 | 分类于 CSS grid响应式系统123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148@charset "UTF-8";// 容器.container { margin-right: auto; margin-left: auto; &::after, &::before { display: table; content: ""; } &::after { clear: both; }}// 百分比.container-fluid { margin-right: auto; margin-left: auto; &::after, &::before { display: table; content: ""; } &::after { clear: both; }}// row.g-row { &::after, &::before { display: table; content: ""; } &::after { clear: both; }}@media (min-width: 768px) { .container { width: 750px; }}@media (min-width: 992px) { .container { width: 970px; }}@media (min-width: 1200px) { .container { width: 1170px; }}// 一个格子的宽度$one: (100%/24);// 响应750以下 手机@media (max-width:767px) { @for $i from 1 to 25 { .g-col-xs-#{$i} { float: left; width: $one*$i; } .g-col-xs-offset-#{$i} { margin-left: $one*$i } }}// 响应768以上 平板@media (min-width:768px) { @for $i from 1 to 25 { .g-col-sm-#{$i} { float: left; width: $one*$i; } .g-col-sm-offset-#{$i} { margin-left: $one*$i } }}// 响应992以上 电脑小屏@media (min-width:992px) { @for $i from 1 to 25 { .g-col-md-#{$i} { float: left; width: $one*$i; } .g-col-md-offset-#{$i} { margin-left: $one*$i } }}// 电脑宽屏@media (min-width:1200px) { @for $i from 1 to 25 { .g-col-lg-#{$i} { float: left; width: $one*$i; } .g-col-lg-offset-#{$i} { margin-left: $one*$i } }}@media (max-width:767px) { .g-xs-hidden { display: none !important; } .g-xs-show { display: block !important; }}@media (min-width: 768px) and (max-width: 991px) { .g-sm-hidden { display: none !important; } .g-sm-show { display: block !important; }}@media (min-width: 992px) and (max-width: 1199px) { .g-md-hidden { display: none !important; } .g-md-show { display: block !important; }}@media (min-width: 1200px) { .g-lg-hidden { display: none !important; } .g-lg-show { display: block !important; }}