SASS第七篇 SASS中带参数混合

2020-10-28 15:48:58 浏览数 (1)

代码语言:javascript复制
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		/*scss代码,如下*/
		/*@mixin whc($w:100px,$h:100px,$c:#000)
		{
			width: $w;
			height: $h;
			background: $c;
		}
		.box1
		{
			@include whc(300px,300px,red);
		}
		.box2
		{
			@include whc($c:blue);
		}*/
		/*以下是css代码*/
		.box1 {
		  width: 300px;
		  height: 300px;
		  background: red;
		}

		.box2 {
		  width: 100px;
		  height: 100px;
		  background: blue;
		}
	</style>
</head>
<body>
	<div class="box1"></div>
	<div class="box2"></div>
</body>
</html>

核心:必须完成匹配完不然会错的.

0 人点赞