发表于: 2018-05-14 23:40:08
1 600
今天完成的事情:
学习bootsarp4.0栅格布局
明天计划的事情:
做完任务14.15
遇到的问题:
暂无
收获:
如何使用sass函数布局栅格循环布局
if函数
f_function.html
<html>
<head><meta charset="utf-8"> <title>控制指令和表达式</title> <link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<h2>Welcome to Yiibai Yiibai</h2>
</body>
</html>
if() 是 Sass 的一个内建函数,与之相似的 @if 则是一个内建指令。if() 用来做条件判断并返回特定值,示例如下:
@mixin test($condition){ $color: if($condition,blue,red);
color:$color;
}
.First{
@include test(true);
}
.Second{
@include test(false);
}
@if 后跟一个表达式,如果表达式的结果为 true,则返回特定的样式,示例如下:
@mixin txt($weight) { color: white;
@if $weight == bold { font-weight: bold;}
}
.txt1 {
@include txt(none);
}
.txt2 {
@include txt(bold);
}
评论