扫码关注官方订阅号
看了阮一峰大神的博客是如下写的,可是怎么都没有效果
.box { display: flex; } .item:nth-child(2) { align-self: center; } 只能是如下的效果
ringa_lee
他的这个例子没写对,他页面上还有其他一些例子是错的
可以再增加第三个 item ,背景设为透明来隐藏然后 box 设置 justify-content: space-between
justify-content: space-between
body{ background: rgb(44, 44, 44) } .box { display: flex; width: 200px; height: 200px; background: rgb(225,225,225); border-radius:10px; border:outset white 10px; } .item{ width: 30%; height: 30%; background: rgb(44, 44, 44); border-radius: 50%; } .item:nth-child(1) { margin: 5px } .item:nth-child(2) { align-self: center; }
样式没加,哥们
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
他的这个例子没写对,他页面上还有其他一些例子是错的
可以再增加第三个 item ,背景设为透明来隐藏
然后 box 设置
justify-content: space-between样式没加,哥们