<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SCSS</title>
<link rel="stylesheet" href="./main.scss" />
</head>
<body>
<div class="container">
<div class="box01 box"></div>
<div class="box02 box"></div>
<div class="box03 box"></div>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
@mixin size($width, $height) {
width: $width;
height: $height;
}
@mixin test {
border: 1px solid black;
box-sizing: border-box;
background-color: #ccc;
}
.container {
display: flex;
@include size(620px, 200px);
@include test;
.box {
@include size(200px, 200px);
@include test;
&.box02 {
margin: 0 10px;
}
@for $i from 1 through 3 {
// for 사용. i가 1부터 3까지.
&:nth-child(#{$i}) {
background-image: url(./images/new0#{$i}_off.jpg);
background-size: cover;
}
&:nth-child(#{$i}):hover {
background-image: url(./images/new0#{$i}_on.jpg);
background-size: cover;
}
}
}
}