问题遇到的现象和发生背景
Flex布局中设置了容器留白均分,不能在设置项目居中
问题相关代码,请勿粘贴截图
<div>
<a href="">
<span></span>
</a>
<a href="">
<span></span>
<span></span>
</a>
<a href="">
<span></span>
<span></span>
<span></span>
</a>
</div>
a {
display: flex;
margin-bottom: 20px;
position: relative;
left: 50%;
top: 200px;
width: 50px;
height: 50px;
background-color: aliceblue;
padding: 10px;
border-radius: 5px;
}
a span {
width: 12px;
height: 12px;
border-radius: 50%;
background-color: black;
}
a:nth-child(3) {
flex-direction: column;
}
a:nth-child(3) {
justify-content: space-evenly;
}
a:nth-child(3) span:nth-child(2) {
justify-content: center;
align-items: center;
background-color: aquamarine;
}
运行结果及报错内容
三个span主轴方向均匀排列,但是第二个不能去中间,第三个不能去最右
我的解答思路和尝试过的方法
添加第二个span的背景颜色是变的,说明是主轴方向的位置属性冲突,但是自学css找不出原因
我想要达到的结果
想做出类似骰子的三点样式。