irpas技术客

解决浏览器/ios出现横向滚动条_前端摸鱼小白菜

网络 2058

解决方式:

父元素:overflow:hidden,并设置高度

子元素:overflow:auto,padding-bottom设置超过父元素高度

使得滚动条往下移动,利用父元素的overflow:hidden隐藏滚动条

例子: html <div class="num"> <div class="number"> <span class= "index" v-for=" item in 19" :key="item" >{{item}}</span> </div> </div> css: .num{ margin-top: 200px; height: 30px; overflow: hidden; } .number{ white-space: nowrap; overflow: auto; padding-bottom: 60px; } .index{ display: inline-block; background: rgb(189, 100, 100); width: 30px; height: 30px; line-height: 30px; text-align: center; margin-right: 10px; } 效果:


1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,会注明原创字样,如未注明都非原创,如有侵权请联系删除!;3.作者投稿可能会经我们编辑修改或补充;4.本站不提供任何储存功能只提供收集或者投稿人的网盘链接。

标签: #解决浏览器ios出现横向滚动条