12.图片滑动

1.gif

  1. <div class="wrapper">
  2. <div class="container">
  3. <img src="src/assets/logo.png" alt="">
  4. <img src="src/assets/logo.png" alt="">
  5. <img src="src/assets/logo.png" alt="">
  6. <img src="src/assets/logo.png" alt="">
  7. <img src="src/assets/logo.png" alt="">
  8. <img src="src/assets/logo.png" alt="">
  9. </div>
  10. </div>
  1. //css样式
  2. <style>
  3. .wrapper{
  4. overflow-x: auto;
  5. overflow-y: hidden;
  6. border: 1px solid #333;
  7. }
  8. img{
  9. width: 250px;
  10. }
  11. /* 去掉滚动条,但是在移动端上划不动 */
  12. /* .wrapper::-webkit-scrollbar{
  13. display: none;
  14. } */
  15. .container{
  16. display: grid;
  17. grid-template-columns:repeat(5,250px) ; //5:分成5份
  18. gap:10px; //间隔
  19. }
  20. </style>

列题:

  1. <div class="picWalls">
  2. <div v-for="datas of data.clips" :key="datas">
  3. <img :src="datas.small" alt="">
  4. </div>
  5. </div>
  6. //css样式
  7. .picWalls{
  8. overflow-x: auto;
  9. overflow-y: hidden;
  10. display: grid;
  11. grid-template-columns: repeat(5, 150px);
  12. gap: 20px;
  13. }
  14. .picWalls img{
  15. width: 150px;
  16. height: 80px;
  17. }