로그인 내용을 화면 가운데로 오게 하기 위해 .wrap { }부분에 margin: auto 를 적용했을때,
생각해보니 상하좌우의 여백을 최대로 민다면 좌,우 말고도 위,아래로도 중간에 위치해야 할 것 같은데
결과적으로는 왜 상하 여백 적용이 안되어 있나요?
혹시 몰라 height 값을 설정해 보았는데도 변화가 없습니다.
만약 화면의 상하좌우 중간에 내용을 위치시키고 싶으면 어떻게 해야하나요?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>로그인 페이지</title>
<link href="https://fonts.googleapis.com/css2?family=Nanum+Gothic+Coding&display=swap" rel="stylesheet">
<style>
*{
font-family: 'Nanum Gothic Coding', monospace;
}
.mytitle {
width: 300px;
height: 200px;
color: white;
text-align: center;
background-image: url("https://www.ancient-origins.net/sites/default/files/field/image/Agesilaus-II-cover.jpg");
background-size: cover;
background-position: center;
border-radius: 10px;
padding-top: 40px;
}
.wrap {
width: 300px;
height: 300px;
margin: auto;
}
</style>
</head>
<body>
<div class="wrap">
<div class="mytitle">
<h1>로그인 페이지</h1>
<h5>아이디, 비밀번호를 입력해주세요</h5>
</div>
<p>ID: <input type="text"/></p>
<p>PW: <input type="text"/></p>
<button>로그인하기</button>
</div>
</body>
</html>