강의 2:00부분에서 display:flex 이거 적용하면 선생님꺼랑 다르게 되요
.hexagon .caption {
position: absolute;
width: inherit;
height: inherit;
color: #fff;
transition: 0.5s;
display: flex;
}
이런식으로 h태그랑 p태그가 나란히 배치되어 버려요.
<!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>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="frame">
<div class="hexagon">
<div class="shape">
<div class="caption">
<h2>Photographer</h2>
<p>
As in other arts, the definitions of amateur and professional are not entirely categorical.
</p>
</div>
<img src="images/artist-01.jpg">
</div>
</div>
<div class="hexagon">
<div class="shape">
<div class="caption">
<h2>Musician</h2>
<p>
A composer is a musician who creates musical compositions.
</p>
</div>
<img src="images/artist-02.jpg">
</div>
</div>
<div class="hexagon">
<div class="shape">
<div class="caption">
<h2>Sculptor</h2>
<p>
Sculpture is the branch of the visual arts that operates in three dimensions..
</p>
</div>
<img src="images/artist-03.jpg">
</div>
</div>
</div>
</body>
</html>
/* Google Web Font */
@import url('https://fonts.googleapis.com/css?family=Montserrat:300,400,500&display=swap');
*{
box-sizing: border-box;
}
body {
font-family: 'Montserrat', sans-serif;
margin: 0;
padding: 0;
color: #333;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
a{
text-decoration: none;
color: inherit;
}
.frame {
display: flex;
gap: 40px;
}
.hexagon {
width: 400px;
height: 450px;
position: relative;
}
.shape {
clip-path: polygon(50% 0, 100% 30%, 100% 70%, 50% 100%, 0 70%, 0 30%);
width: inherit;
height: inherit;
position: absolute;
}
.shape img {
width: inherit;
height: inherit;
object-fit: cover;
object-position: right;
}
.hexagon .caption {
position: absolute;
width: inherit;
height: inherit;
color: #fff;
transition: 0.5s;
display: flex;
}
뭘 잘못한걸까요 ㅠㅠ
답변 1