html 用Sass加载占位符 Posted 2021-05-10
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 用Sass加载占位符相关的知识,希望对你有一定的参考价值。
@mixin nth-children($points...) {
@each $point in $points {
&:nth-child(#{$point}) {
@content;
}
}
}
.text-input__loading {
height: 214px;
border: 1px solid lightgrey;
border-radius: 4px;
width: 100%;
&--line {
height: 10px;
margin: 10px;
animation: pulse 1s infinite ease-in-out;
}
div {
@include nth-children(1, 5, 9) {
width: 150px;
}
@include nth-children(2, 6, 10) {
width: 250px;
}
@include nth-children(3, 7) {
width: 50px;
}
@include nth-children(4, 8) {
width: 100px;
}
}
}
@keyframes pulse {
0% {
background-color: rgba(165, 165, 165, 0.1)
}
50% {
background-color: rgba(165, 165, 165, 0.3)
}
100% {
background-color: rgba(165, 165, 165, 0.1)
}
}
Loading Placeholder with Sass
-----------------------------
A [Pen](https://codepen.io/leerob/pen/XzRzpb) by [Lee Robinson](https://codepen.io/leerob) on [CodePen](https://codepen.io).
[License](https://codepen.io/leerob/pen/XzRzpb/license).
<div class='text-input__loading'>
<div class='text-input__loading--line'></div>
<div class='text-input__loading--line'></div>
<div class='text-input__loading--line'></div>
<div class='text-input__loading--line'></div>
<div class='text-input__loading--line'></div>
<div class='text-input__loading--line'></div>
<div class='text-input__loading--line'></div>
<div class='text-input__loading--line'></div>
<div class='text-input__loading--line'></div>
<div class='text-input__loading--line'></div>
</div>
以上是关于html 用Sass加载占位符的主要内容,如果未能解决你的问题,请参考以下文章
html Sass:占位符 - 存在()在Sass #sass中
html Sass:多态占位符和mixins #sass
html Sass:自动占位符复制CSS声明。 #sass
html Sass:占位符工厂(Mixin)基于argumetns #sass
html Sass mixin / extend /占位符比较
html 图像替换扩展占位符和在sass中使用extend的示例