css3 - 如图的flex骰子布局是怎么实现的?
问题描述
看了阮一峰大神的博客是如下写的,可是怎么都没有效果
<p class='box'> <span class='item'></span> <span class='item'></span></p>.box { display: flex;}.item:nth-child(2) { align-self: center;}只能是如下的效果
问题解答
回答1:他的这个例子没写对,他页面上还有其他一些例子是错的
可以再增加第三个 item ,背景设为透明来隐藏然后 box 设置 justify-content: space-between
回答2: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;}回答3:
样式没加,哥们
相关文章:
1. mysql - 数据库建字段,默认值空和empty string有什么区别 1102. 问一下代码哪里出错了????3. mybatis - Java关于Mysql的随机id生成4. Mac下phpinfo和php -m里的扩展不一致怎么解决?5. 求问:其它输出都正常,就是错误输出是乱码!6. python - UTC格式转换成本地时间7. angular.js - 在ionic下,利用javascript导入百度地图,pc端可以显示,移动端无法显示8. python - 如何使用requests模块在一个post中提交含有多个相同名称的数据?9. windows - Mysql数据库部署 能否不安装服务?10. 冒昧问一下,我这php代码哪里出错了???