기본 상태
//html
<div id="outer_wrapper">
<div id="inner_wrapper">안녕하세요!</div>
<div id="inner_wrapper">hello!</div>
</div>
//css
#outer_wrapper{
display: flex;
}
#inner_wrapper{
border: solid 1px black;
}
1. flex-direction: column일 경우
align-items: center
사용
//css
#outer_wrapper{
display: flex;
flex-direction: column;
align-items: center;
}
#inner_wrapper{
border: solid 1px black;
}
2. flex-direction: row일 경우
justify-content:center
사용
//css
#outer_wrapper{
display: flex;
flex-direction: row;
justify-content: center;
}
#inner_wrapper{
border: solid 1px black;
}
'Frontend > HTML&CSS' 카테고리의 다른 글
[HTML & CSS] CSS Grid minmax로 내부 요소 비율 유지하기 (feat. text 말줄임표 처리) (2) | 2024.06.23 |
---|---|
[styled-components] Grid로 반응형 구현 (1) | 2024.01.05 |
[html & css] 드래그 방지 (0) | 2023.02.19 |
[HTML/CSS] 네이버 메뉴바 (0) | 2022.11.10 |