当前位置:Gxlcms > JavaScript > JS实现瀑布流布局的实例分析

JS实现瀑布流布局的实例分析

时间:2021-07-01 10:21:17 帮助过:4人阅读

本文实例为大家分享了JS实现瀑布流布局展示的具体代码,供大家参考,具体内容如下

html部分


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>瀑布流布局</title>
  <script src="wallpoll.js"></script>
  <link rel="stylesheet" href="wallpoll.css" rel="external nofollow" >
</head>
<body>
  <p id="main">
    <p class="box">
      <p class="pic">
        <img src="wallpoll/0.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/0.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/1.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/2.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/3.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/4.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/5.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/6.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/7.jpg" alt="">
      </p>
    </p>

    <p class="box">
      <p class="pic">
        <img src="wallpoll/8.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/9.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/10.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/11.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/12.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/13.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/14.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/15.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/16.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/17.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/18.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/19.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/20.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/21.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/22.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/23.jpg" alt="">
      </p>
    </p>
    <p class="box">
      <p class="pic">
        <img src="wallpoll/24.jpg" alt="">
      </p>
    </p>
  </p>
</body>
</html>

css部分


*{
  padding:0px;
  margin:0px;
}
.main{
  position:relative;
}
.box{
  padding:15px 0 0 10px;
  float:left;
}
.pic{
  padding:10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-shadow: 0 0 5px #ccc;
  /*float:left;*/
}
img{
  width:170px;
  height:auto;
}

JS部分


课程地址。

以上就是JS实现瀑布流布局的实例分析的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行