移动端横向滚动
作者:互联网
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> body{ background-color: #ccc; } .s-header{ overflow: hidden; height: 40px; } .s-header div:nth-child(1){ float: left; margin-left: 20px; margin-top: 9px; font-size: 10px; } .s-header div:nth-child(2){ float: right; margin-right: 20px; margin-top: 9px; border:1px solid #000; padding: 4px; border-radius: 12px; font-size: 10px; } .s-con{ height: 172px; display: -webkit-box; overflow-x: scroll; -webkit-overflow-scrolling:touch; } .swiper{ height: 164px; width: 280px; background: url('./1.png') no-repeat; background-size: 100% 100%; position: relative; margin: 4px; } .swiper .c1 { position: absolute; bottom: 0; left: 0; width: 100%; background-color:rgba(0,0,0,0.3); } .swiper .c1 .zhi{ overflow: hidden; text-overflow: ellipsis; -o-text-overflow: ellipsis; white-space: nowrap; width: 200px; margin: 0; } .swiper .c1 .icon{ width: 100%; overflow: hidden; } .left{ float: left; } .right { float:right; } </style> </head> <body> <div class="content"> <div class="s-header"> <div>周边动态</div> <div>全部动态</div> </div> <div class="s-con"> <div class="swiper"> <!-- 下面的内容 --> <div class="c1"> <div class="zhi">嘻嘻嘻嘻嘻嘻嘻嘻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻</div> <div class="icon"> <div class="left"> <i>左</i> <i>左</i> </div> <div class="right"> <i>右</i> <i>右</i> </div> </div> </div> </div> <div class="swiper"> <!-- 下面的内容 --> <div class="c1"> <div class="zhi">嘻嘻嘻嘻嘻嘻嘻嘻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻</div> <div class="icon"> <div class="left"> <i>左</i> <i>左</i> </div> <div class="right"> <i>右</i> <i>右</i> </div> </div> </div> </div> <div class="swiper"> <!-- 下面的内容 --> <div class="c1"> <div class="zhi">嘻嘻嘻嘻嘻嘻嘻嘻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻</div> <div class="icon"> <div class="left"> <i>左</i> <i>左</i> </div> <div class="right"> <i>右</i> <i>右</i> </div> </div> </div> </div> <div class="swiper"> <!-- 下面的内容 --> <div class="c1"> <div class="zhi">嘻嘻嘻嘻嘻嘻嘻嘻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻</div> <div class="icon"> <div class="left"> <i>左</i> <i>左</i> </div> <div class="right"> <i>右</i> <i>右</i> </div> </div> </div> </div> <div class="swiper"> <!-- 下面的内容 --> <div class="c1"> <div class="zhi">嘻嘻嘻嘻嘻嘻嘻嘻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻</div> <div class="icon"> <div class="left"> <i>左</i> <i>左</i> </div> <div class="right"> <i>右</i> <i>右</i> </div> </div> </div> </div> <div class="swiper"> <!-- 下面的内容 --> <div class="c1"> <div class="zhi">嘻嘻嘻嘻嘻嘻嘻嘻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻寻</div> <div class="icon"> <div class="left"> <i>左</i> <i>左</i> </div> <div class="right"> <i>右</i> <i>右</i> </div> </div> </div> </div> </div> </div> <script> </script> </body> </html>
标签:right,滚动,寻寻,横向,嘻嘻,overflow,移动,margin,left 来源: https://www.cnblogs.com/Alitar/p/10749622.html