SASS(SCSS)
Sass(Scss) ์์๋ณด๊ธฐ๐
Sass์ SCSS๋ ์ฐจ์ด์ ์?
Nesting(์ค์ฒฉ)
.bottom-bar-section {
ul {
list-style-type: none;
margin: 0;
padding-bottom: 20px;
padding-left: 0;
}
li {
padding-bottom: 5px;
}
p {
margin-top: 40px;
}
}
Ampersand (์์ ์ ํ์ ์ฐธ์กฐ)
header {
position: fixed;
top: 0;
z-index: 10000;
width: 60%;
margin-left: 20%;
height: 60px;
background-color: #f4f4f2;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(144, 104, 104, 0.05);
&:hover .nav li {
opacity: 1;
transition: all 0.5s;
}
&:not(:hover) .nav li {
opacity: 0.3;
transition: all 0.5s;
}
}
์์ฑ ์ค์ฒฉ
.box {
font: {
weight: bold;
size: 10px;
family: sans-serif;
};
margin: {
top: 10px;
left: 20px;
};
padding: {
bottom: 40px;
right: 30px;
};
}
๋ณ์(Variables)
$color-primary: #e96900;
$url-images: "/assets/images/";
$w: 200px;
.box {
width: $w;
margin-left: $w;
background: $color-primary url($url-images + "bg.jpg");
}
์ฐ์ฐ๊ฐ๋ฅ
width: 50% - 20px; // ๋จ์ ๋ชจ์ ์๋ฌ(Incompatible units error)
width: calc(50% - 20px); // ์ฐ์ฐ ๊ฐ๋ฅ
@mixin(์ฌํ์ฉ)
@mixin ์๋ช
{
font-size: 22px;
font-weight: bold;
font-family: sans-serif;
color: orange;
}
h1 {
@include ์๋ช
;
}
@if()
@if (์กฐ๊ฑด1) {
/_ ์กฐ๊ฑด1์ด ์ฐธ์ผ ๋ ๊ตฌ๋ฌธ _/
} @else if (์กฐ๊ฑด2) {
/_ ์กฐ๊ฑด2๊ฐ ์ฐธ์ผ ๋ ๊ตฌ๋ฌธ _/
} @else {
/_ ๋ชจ๋ ๊ฑฐ์ง์ผ ๋ ๊ตฌ๋ฌธ _/
}