scss 萨斯
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss 萨斯相关的知识,希望对你有一定的参考价值。
@mixin backface-visibility($visibility: hidden) { // mixin - snippet of code; takes arguments and default values
backface-visibility: $visibility;
-webkit-backface-visibility: $visibility;
-moz-backface-visibility: $visibility;
-ms-backface-visibility: $visibility;
-o-backface-visibility: $visibility;
}
@mixin transform-style($style) {
transform-style: $style;
-moz-transform-style: $style;
-o-transform-style: $style;
-ms-transform-style: $style;
-webkit-transform-style: $style;
}
@mixin transition($time) {
transition: $time;
-webkit-transition: $time;
-moz-transition: $time;
-o-transition: $time;
};
@mixin hover-color($color) { // & means parent; when used, will create pseudo-class hover
&:hover {
color: $color;
}
}
@mixin stripes($direction, $width-percent, $stripe-color, $stripe-background: #FFF) {
background: repeating-linear-gradient(
$direction,
$stripe-background,
$stripe-background ($width-percent - 1),
$stripe-color 1%,
$stripe-background $width-percent
);
}
@mixin transform($transformation) {
transform: $transformation;
-webkit-transform: $transformation;
-moz-transform: $transformation;
-ms-transform: $transformation;
-o-transform: $transformation;
}
@mixin photo-content($file) {
object-fit: cover;
content: url(#{$file}.jpg); // string interpolation - to customize links
}
$stripe-properties: to bottom, 15%, blue, white;
.notecard {
width: 300px;
height: 180px;
border: 1px solid black;
display: inline-block;
margin: 20px;
font-family: Roboto, sans-serif;
box-shadow: 1px 1px 2px 2px rgba(0,0,0,.2);
@include transform-style(preserve-3d);
@include transition(0.4s);
&:hover {
@include transform (rotatey(-180deg));
}
.front, .back {
width: 100%;
height: 100%;
position: absolute;
@include backface-visibility;
}
.front {
z-index: 3;
font-size: 20px;
.word {
display: block;
text-align: center;
position: relative;
top: 40%;
@include hover-color(red);
}
}
.back {
z-index: 1;
word-wrap: break-word;
line-height: 1.6;
@include transform(rotatey(-180deg))
.definition {
width: 100%;
height: 100%;
@include stripes($stripe-properties...);
.photo {
width: 60%;
margin: 0px auto;
@include photo-content('titanosaur');
}
}
}
}
@import url(https://fonts.googleapis.com/css?family=Pacifico);
//Add variables here:
$translucent-white: rgba(255,255,255,0.3); // variables
$icon-square-length: 300px;
$standard-border: 4px solid black;
h1 {
font-family: Roboto, sans-serif;
text-align: center;
}
.banner {
font-family: 'Pacifico', cursive;
height: 400px;
background-image: url("lemonade.jpg");
border : { // nesting
top: $standard-border; // usage of variables
bottom: $standard-border;
}
.slogan {
position: absolute;
border: $standard-border;
top: 200px;
left: 25%;
width: 50%;
height: 200px;
text-align: center;
background-color: $translucent-white;
span {
font-size: 24px;
line-height: 200px;
}
}
}
.container {
text-align: center;
font-family: 'Pacifico', cursive;
.icon {
display: inline-block;
margin: 2%;
border: $standard-border;
font-size: 32px;
width: $icon-square-length;
height: $icon-square-length;
}
}
以上是关于scss 萨斯的主要内容,如果未能解决你的问题,请参考以下文章