커뮤니티
포인트
로딩중
쿠폰
내 강의실
국비 신청 내역
수강권
증명서
숙제 피드백
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
margin: auto 를 적용할때 상,하 부분 여백은 왜 적용되지 않나요?
[왕초보] 비개발자를 위한, 웹개발 종합반 (프로그래밍 실무, 풀스택)
1주차
북마크
오*아
댓글
7
추천
0
조회수
40
조회수
40
답변 완료

로그인 내용을 화면 가운데로 오게 하기 위해 .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>




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴