커뮤니티
포인트
로딩중
쿠폰
내 강의실
국비 신청 내역
수강권
증명서
숙제 피드백
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
두줄 이상일 때 flex로 가운데 정렬 방법이 궁금해요!
웹개발 종합반
2주차
북마크
김*민
댓글
10
추천
0
조회수
42
조회수
42
답변 완료
<div class="text1" id="text1">
    <h1>환영합니다.</h1>
</div>
<div class="text2" id="text2">
    <h1>example<br>sentence.</h1>
</div>
<div class="text3" id="text3">
    <h1><p>also</p>this is example text</h1>
</div>



.text1{
    display: flex;
    flex-direction: center;
    justify-content: center;
    align-items: center;
    }

text1의 경우 justify-contentalign-items를 사용하여 상하,좌우 중앙에 배치가 되는데


.text2{ /*text3도 마찬가지*/
    display: flex;
    flex-direction: center;
    justify-content: center;
    align-items: center;
    }

text2와 3 같은 경우는 <p>나 <br> 어떤 것을 써서 줄 바꿈을 해도 좌우는 중앙에 배치되는데 상하가 위쪽으로 배치가 되네요.

text가 두 줄일 때 flex로 중앙에 배치 할 수 있는 방법이 있을까요?

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