JSFiddle - React, Tailwind, and code Playground
by DohanKwon
HTML
<div class="container">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
</div>
SCSS
// Init~ Don't touch here!
$color: #555;
body {
padding: 80px;
font-family: 'NanumSquareRound',sans-serif;
color: $color;
}
.container {
// width: 380px;
// height: 250px;
border: 10px solid rgba(black, .1);
border-radius: 10px;
display: grid;
}
.item {
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
box-sizing: border-box;
position: relative;
font-size: 20px;
color: $color;
font-weight: 900;
text-shadow: 3px 0 0 rgba(white, .5);
&::before {
content: "";
position: absolute;
top: 5px;
left: 5px;
border: 4px solid $color;
border-radius: 10px;
box-sizing: border-box;
width: calc(100% - 10px);
height: calc(100% - 10px);
z-index: -1;
}
$colors: (tomato, orange, limegreen, dodgerblue, hotpink, darkgray, crimson, orangered, lawngreen, aqua, royalblue, wheat, brown, gray, salmon, deeppink, gold, springgreen, slateblue, darkslategray);
@each $color in $colors {
$index: index($colors, $color);
&:nth-child(#{$index})::before {
background-color: rgba($color, .8);
}
}
&::after {
content: "";
width: 10px;
height: 50%;
background: white;
position: absolute;
top: 16px;
left: 16px;
border-radius: 100px;
opacity: .3;
z-index: -1;
}
}
// Test here!
.container {
width: 300px;
height: 300px;
display: grid;
grid-template-rows: 100px 100px;
grid-template-column: repeat(2, 150px);
grid-auto-rows: 100px;
}
.item:nth-child(3) {
grid-rows: 3 / 4;
}