<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.wrap{
width: 500px;
height: 500px;
margin: 100px auto;
position: relative;
display: flex;
align-items: center;
font-size: 50px;
justify-content: center;
background-color: lightgray;
}
.wrap h2{
opacity: 0;
transition: 1s;
}
.line{
position: absolute;
background-color: black;
transition: 1s;
}
.top{
width: 0%;
height: 10px;
top: 0;
left: 0;
}
.right{
width:10px;
height: 0%;
top: 0;
right: 0;
}
.bottom{
width: 0%;
height: 10px;
bottom: 0;
right: 0;
}
.left{
width:10px;
height: 0%;
bottom: 0;
left: 0;
}
.wrap:hover .top{
width: 100%;
}
.wrap:hover .right{
height: 100%;
transition-delay: 1s;
}
.wrap:hover .bottom{
width: 100%;
transition-delay: 2s;
}
.wrap:hover .left{
height: 100%;
transition-delay: 3s;
}
.wrap:hover h2{
opacity: 1;
transition-delay: 4s;
}
</style>
</head>
<body>
<div class="wrap">
<div class="line top"></div>
<div class="line right"></div>
<div class="line bottom"></div>
<div class="line left"></div>
<h2>Title</h2>
</div>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.wrap{
width: 500px;
height: 500px;
margin: 100px auto;
position: relative;
display: flex;
align-items: center;
font-size: 50px;
justify-content: center;
background-color: lightgray;
}
.wrap h2{
opacity: 0;
transition: 1s;
}
.line{
position: absolute;
background-color: black;
transition: 1s;
}
.top{
width: 0%;
height: 10px;
top: 0;
left: 0;
}
.right{
width:10px;
height: 0%;
top: 0;
right: 0;
}
.bottom{
width: 0%;
height: 10px;
bottom: 0;
right: 0;
}
.left{
width:10px;
height: 0%;
bottom: 0;
left: 0;
}
.wrap:hover .top{
width: 100%;
}
.wrap:hover .right{
height: 100%;
transition-delay: 1s;
}
.wrap:hover .bottom{
width: 100%;
transition-delay: 2s;
}
.wrap:hover .left{
height: 100%;
transition-delay: 3s;
}
.wrap:hover h2{
opacity: 1;
transition-delay: 4s;
}
</style>
</head>
<body>
<div class="wrap">
<div class="line top"></div>
<div class="line right"></div>
<div class="line bottom"></div>
<div class="line left"></div>
<h2>Title</h2>
</div>
</body>
</html>
#스타일시트 트랜지션 문제1