基于SASS的网格系统
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于SASS的网格系统相关的知识,希望对你有一定的参考价值。
You just need to configure the width, columns, and gutter
// Custom Grid System $grid_width : 960px; $grid_col : 12; $grid_gut : 20px; body { min-width: $grid_width; } .container_#{$grid_col} { margin-left: auto; margin-right: auto; width: $grid_width; @for $i from 1 through $grid_col { .grid_#{$i} { display: inline; float: left; margin-left: $grid_gut / 2; margin-right: $grid_gut / 2; } .push_#{$i}, .pull_#{$i} { position: relative; } .grid_#{$i} { width: ( ($grid_width / $grid_col - $grid_gut) * $i ) + (($i - 1) * $grid_gut); } .prefix_#{$i} { padding-left: $grid_width / $grid_col * $i ; } .suffix_#{$i} { padding-right: $grid_width / $grid_col * $i ; } .push_#{$i} { left: $grid_width / $grid_col * $i ; } .pull_#{$i} { right: $grid_width / $grid_col * $i ; } } .alpha { margin-left: 0; } // no left margin .omega { margin-right: 0; } // no right margin }
以上是关于基于SASS的网格系统的主要内容,如果未能解决你的问题,请参考以下文章
scss 基于行高的基线网格SASS mixin,支持rem和px。显示在页面内容上方。按W切换
scss 基于行高的基线网格SASS mixin,支持rem和px。显示在页面内容上方。按W切换