display: flex - 기본값(가로 정렬)
flex-direction: column - 세로정렬
flex-direction: row - 가로정렬
align-items: center - 가운데 정렬
flex-wrap: wrap - 태그가 범위를 벗어나면 줄바꿈
<template>
<div id="total">
<div class="main">
<router-link to="/">main</router-link>
</div>
<div id="memu">
<div class="item">
<router-link to="spanish">spanish</router-link>
</div>
<div class="item">
<router-link to="weather">weather</router-link>
</div>
<div class="item">
<router-link to="todo">todo</router-link>
</div>
<div class="item">
<router-link to="trade">trade</router-link>
</div>
</div>
<div>
<router-view></router-view>
</div>
</div>
</template>
<script>
export default {
name: 'main',
data() {
return {
}
}
}
</script>
<style scoped>
/* https://codepen.io/hexagoncircle/pen/XWbWKwL */
#total{
border: 3px solid black;
display: flex;
flex-direction: column;
align-items: center;
background-color: aqua;
}
.main{
border: 3px solid black;
margin-top: 100px;
}
#memu{
border: 3px solid black;
display: flex;
flex-direction: row;
align-items: center;
padding-top: 50px;
}
.item{
border: 3px solid red;
margin: 10px;
width: 100px;
height: 100px;
/* display: inline-block; */
}
</style>
1. 검정색 박스는 column(세로 정렬)
2. 빨간색 박스는 row(가로 정렬)
3. 파란색 배경 가장 큰박스 기준으로 center(가운데 정렬)
'CSS' 카테고리의 다른 글
[CSS] transition (0) | 2020.04.07 |
---|---|
[CSS] background (0) | 2020.04.07 |
[CSS] position (0) | 2020.04.03 |
[CSS] inline vs block (0) | 2020.03.31 |
[CSS] 적용 우선순위 (0) | 2020.03.31 |