Flex 绘制三点骰子
实现效果
.html
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
.css
.container {
width: 100px;
height: 100px;
display: flex;
justify-content: space-between;
}
.item {
width: 24px;
height: 24px;
border-radius: 50%;
background-color: #000;
}
.item:nth-child(2) {
align-self: center;
}
.item:nth-child(3) {
align-self: flex-end;
}
主要是用到 align-self,控制第二和第三个点的位置。