大家好我发现了一个HTML代码,它使用了scss。当我试图转换它时我有很多错误可以有人为我转换它。我是html的初学者,我不知道scss {{3 }}
@function rndNumber($limit) {
@return random($limit);
}
$globalSize: 400%;
$colorsList: ($white, $white, $white);
$bgDots: ();
$resultPosList: ();
$prevPosList: ();
$resultSizeList: ();
$prevSizeList: ();
$randomSize: 0;
@for $i from 1 through 16 {
$thisColor: nth($colorsList, rndNumber(3));
$bgDots: append($bgDots, radial-gradient($thisColor, $thisColor 70%, transparent 71%), 'comma');
$resultPosList: append($resultPosList, (rndNumber(100) * 1%) (rndNumber(100) * 1%), 'comma');
$prevPosList: append($prevPosList, 50% 50%, 'comma');
$randomSize: rndNumber(3) * 2%;
$resultSizeList: append($resultSizeList, $randomSize $randomSize, 'comma');
$prevSizeList: append($prevSizeList, .25em .25em, 'comma');
}
.sparks {
&:before {
content: '';
position: absolute;
pointer-events: none;
z-index: 1;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: $globalSize;
height: $globalSize;
background-image: $bgDots;
background-size: $prevSizeList;
background-position: $prevPosList;
background-repeat: no-repeat;
transition: all 0s ease-out;
transition-delay: 0;
}
}
.card {
height: 15em;
border-radius: 15em 15em 0 0;
display: flex;
align-items: flex-end;
justify-content: center;
background-color: rgba($white, .2);
}
.rating {
&__label {
cursor: pointer;
padding: 1em;
display: flex;
box-sizing: border-box;
transition: all $fastDuration ease-in-out;
border: 1px solid rgba($white, .2);
margin-left: -1px;
&__icon {
z-index: 2;
transition: fill $fastDuration ease-in-out;
}
@for $i from 1 through 5 {
&:nth-of-type(#{5-$i}) .rating__label__icon {
transition-delay: ($fastDuration / 4) * $i;
}
}
}
&__background {
width: 100%;
height: 100%;
min-width: 20%;
position: absolute;
border-radius: 3em;
z-index: -1;
bottom: 0;
left: 0;
transition: width $fastDuration $bezier;
background-color: $white;
}
[type='radio'] {
display: none;
}
&__fx {
&--0 {
perspective: 20em;
.rating__label {
transform-style: preserve-3d;
@for $i from 1 through 5 {
&:nth-of-type(#{5-$i}) {
transition-delay: ($fastDuration / 4) * $i;
}
}
}
[type='radio'] {
display: none;
&:checked ~ .rating__label {
background-color: $white;
transform: rotateY(180deg);
.rating__label__icon {
fill: $coral;
}
}
&:first-of-type:checked + .rating__label:before {
background-size: $resultSizeList;
background-position: $resultPosList;
transition-duration: $slowDuration;
transition-delay: $fastDuration * 1.3;
opacity: 0;
}
}
}
&--1 {
position: relative;
@for $i from 1 through 24 {
$thisColor: nth($colorsList, rndNumber(3));
$bgDots: append($bgDots, radial-gradient($thisColor, $thisColor 70%, transparent 71%), 'comma');
$resultPosList: append($resultPosList, (rndNumber(100) * 1%) (rndNumber(100) * 1%), 'comma');
$prevPosList: append($prevPosList, 50% 50%, 'comma');
$randomSize: rndNumber(3) * 2%;
$resultSizeList: append($resultSizeList, $randomSize $randomSize, 'comma');
$prevSizeList: append($prevSizeList, .25em .25em, 'comma');
}
.rating__label {
transform-style: preserve-3d;
border-left-color: transparent;
border-right-color: transparent;
&:first-of-type {
border-radius: 0 3em 3em 0;
border-right-color: rgba($white, .2);
position: relative;
}
&:last-of-type {
border-radius: 3em 0 0 3em;
border-left-color: rgba($white, .2);
}
}
[type='radio'] {
display: none;
@for $j from 5 through 1 {
&:nth-of-type(#{$j}):checked ~ {
.rating__label {
.rating__label__icon {
fill: $coral;
}
}
.rating__background {
$thisColor: hsl((340 - ($j * 20)), 56%, 66%);
$thisPos: 20% * (6 - $j);
// background-color: saturate($thisColor, 55%);
width: $thisPos;
}
}
}
&:first-of-type:checked + .rating__label:before {
background-size: $resultSizeList;
background-position: $resultPosList;
transition-duration: $slowDuration;
transition-delay: $fastDuration;
opacity: 0;
}
}
}
&--2 {
position: relative;
@for $i from 1 through 18 {
$thisColor: nth($colorsList, rndNumber(3));
$bgDots: append($bgDots, radial-gradient($thisColor, $thisColor 70%, transparent 71%), 'comma');
$resultPosList: append($resultPosList, (rndNumber(100) * 1%) (rndNumber(100) * 1%), 'comma');
$prevPosList: append($prevPosList, 50% 50%, 'comma');
$randomSize: rndNumber(3) * 2%;
$resultSizeList: append($resultSizeList, $randomSize $randomSize, 'comma');
$prevSizeList: append($prevSizeList, .25em .25em, 'comma');
}
.rating__label {
transform-style: preserve-3d;
.rating__label__icon {
fill: $coral;
}
}
[type='radio'] {
display: none;
@for $j from 5 through 1 {
&:nth-of-type(#{$j}):checked ~ {
.rating__label {
.rating__label__icon {
fill: $white;
}
}
}
}
&:first-of-type:checked + .rating__label:before {
background-size: $resultSizeList;
background-position: $resultPosList;
transition-duration: $slowDuration;
transition-delay: $fastDuration;
opacity: 0;
}
}
}
}
}
谢谢你的帮助
答案 0 :(得分:1)
使用https://sass2css.herokuapp.com/或http://www.sassmeister.com/
这些可用于将scss
代码转换为CSS
答案 1 :(得分:0)
我只需要编译一个文件,你可以使用:https://www.tutorialspoint.com/sass/try_sass.php 否则你需要sass gem(ruby库)来编译它。请阅读此处了解更多详情:http://sass-lang.com/install为了不让您迷惑,sass gem支持.scss和.sass scss gem不再维护。