最近我在Codepen上进行了一些实验,我想知道如何将网站上展示的代码应用到自己的网站上。我意识到Codepen使用的大部分格式不是纯".css",而是一种叫做".scss"的新东西。我想知道从哪里开始,是否有人能帮助我理解.scss的工作原理,特别是这个。
body{
background:black;
font-family: 'Varela', sans-serif;
}
.glitch{
color:white;
font-size:0px;
position:relative;
width:268px;
height:654px;
margin:0 auto;
text-indent:-999em;
background:transparent url(http://cdn.hiphopwired.com/wp-content/uploads/2013/09/Vanellope-Von-Scweetz-wreck-it-ralph.png) center center no-repeat;
}
@keyframes noise-anim{
$steps:20;
@for $i from 0 through $steps{
#{percentage($i*(1/$steps))}{
clip:rect(random(654)+px,9999px,random(654)+px,0);
}
}
}
.glitch:after{
content:'';
width:100%;
height:100%;
position:absolute;
left:2px;
top:0;
overflow:hidden;
clip:rect(0,900px,0,0);
animation:noise-anim 2s infinite linear alternate-reverse;
background:inherit;
-webkit-filter: hue-rotate(90deg);
filter: hue-rotate(90deg);
}
@keyframes noise-anim-2{
$steps:20;
@for $i from 0 through $steps{
#{percentage($i*(1/$steps))}{
clip:rect(random(100)+px,9999px,random(100)+px,0);
}
}
}
.glitch:before{
content: '';
width:100%;
height:100%;
position:absolute;
left:-2px;
top:0;
overflow:hidden;
clip:rect(0,900px,0,0);
animation:noise-anim-2 3s infinite linear alternate-reverse;
background:inherit;
-webkit-filter: hue-rotate(300deg);
filter: hue-rotate(300deg);
}