flex-direction屬性改變元素排列方向
主軸默認(rèn)是水平方向, 側(cè)軸默認(rèn)是垂直方向
可用屬性值:
row: 行, 水平(默認(rèn)值)
column: 列, 垂直
row-reverse: 行, 從右向左
column-reverse: 列, 從下向上
注意:主軸和側(cè)軸僅僅只是調(diào)換了方向
flex-wrap屬性實現(xiàn)彈性盒子多行排列效果
彈性容器高度被換行的彈性盒子均等分
align-content 取值和jc取值是一樣的, 是針對于多行彈性盒子的側(cè)軸設(shè)置的.
出現(xiàn)的前提條件,必須要先換行 flex-wrap: wrap;
align-items 針對于單行彈性盒子的側(cè)軸對齊方式
實現(xiàn)過多標(biāo)題的固定模板
h2 {
position: relative;
width: 300px;
height: 60px;
background-color: orange;
margin: 50px auto;
text-align: center;
line-height: 60px;
}
h2::before,
h2::after {
position: absolute;
top: 50%;
transform: translateY(-50%);
content: '';
width: 60px;
height: 0;
border-top: 4px solid #000;
}
h2::before {
left: 20px;
}
h2::after {
right: 20px;
}