栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > Html/CSS > CSS教程

Sass

CSS教程 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Sass

%float-left{
	float:left;
	padding:0 15px;
	position: relative;
}
.clearfix{
	&::before,&::after{
		display: table;
		content: '';
	}
	&::after{
		clear: both;
	}
}
.container{
	width:100%;
	margin:0 auto;
	padding: 0 15px;
	@extend .clearfix;
}
.row{
	@extend .clearfix;
	margin: 0 -15px;
}

@for $i from 1 through 12{
	.col-#{$i},.col-sm-#{$i},.col-md-#{$i},.col-lg-#{$i},.col-xl-#{$i}{
		@extend %float-left;
	}
	.col-#{$i}{
		width:percentage($i/12);
	}
}
@for $i from 0 through 12{
	.col-offset-#{$i}{
		margin-left: percentage($i/12);
	}
	.col-push-#{$i}{
		left:percentage($i/12);
	}
	.col-pull-#{$i}{
		right:percentage($i/12);
	}
}
.d-none{
	display: none !important;
}
.d-block{
	display: block !important;
}
@mixin grid($screen,$minWidth,$width){
	@media (min-width:$minWidth){
		.container{
			width:$width;
		}
		@for $i from 1 through 12{
			.col-#{$screen}-#{$i}{
				width:percentage($i/12);
			}	
		}
		@for $i from 0 through 12{
			.col-#{$screen}-offset-#{$i}{
				margin-left: percentage($i/12);
			}
			.col-#{$screen}-push-#{$i}{
				left:percentage($i/12);
			}
			.col-#{$screen}-pull-#{$i}{
				right:percentage($i/12);
			}
		}
		.d-#{$screen}-none{
			display: none !important;
		}
		.d-#{$screen}-block{
			display: block !important;
		}
	}
}
@include grid(sm,576px,540px);
@include grid(md,768px,720px);
@include grid(lg,992px,960px);
@include grid(xl,1200px,1140px);

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/242282.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号