Card
란?장점
두 div
로 나눈다.두 div
로 나눈다.justify-content: flex-end;
를 해준다.float: right;
로 대체될 수 있을 듯 하다.<!DOCTYPE html>
<html lang="en">
<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>Card</title>
<style>
.card-body {
background-color: #000000;
width: 320px;
height: 210px;
border-radius: 3px;
}
.card-img {
width: 320px;
}
.game-title {
font-size: 24px;
margin: 0 30px;
}
span {
margin: 0;
color: white;
}
.flatfrom-icons {
margin: 0 10px 0 20px;
}
.flatfrom-icons>i {
color: white;
}
.small-content {
font-size: 13px;
display: flex;
justify-content: flex-end;
}
</style>
<script src="https://kit.fontawesome.com/af806c52f5.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="card-body">
<img class="card-img" src="./04_card.assets/terraria.jpg" alt="">
<div class="card-content">
<span class="game-title">Terraria</span>
<div class="small-content">
<span>₩ 10,500</span>
<div class="flatfrom-icons">
<i class="fab fa-windows"></i>
<i class="fab fa-apple"></i>
<i class="fab fa-steam"></i>
</div>
</div>
</div>
</div>
</body>
</html>
이후 완성은 하였으나 더 해보고 싶은것이 생겼다.
카드에 마우스를 hover
했을 때 태그들이 쇽쇽 튀어나오게 하고 싶었다.
어떻게 하면 될까?
animation-delay
를 javascript를 통해 순차적으로 시간을 조절하면 되지 않을까?
시도 1
시도 2
tag list를 불러와 for 문으로 처리 한뒤
tagList[i].style.transitionDelay = i * 0.08 + 's';
위와 같은 코드를 추가하여 delay를 주었다.
성공!
position: relative
를 걸어주면position: absolute;
를 사용했을 때 부모 div 안을 기준으로 이동 시킬 수 있다.