<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>CSS3瀑布流</title> <style> /*大层*/ .container{width:80%;margin: 0 auto;} /*瀑布流层*/ .waterfall{ -moz-column-count:4; /* Firefox */ -webkit-column-count:4; /* Safari 和 Chrome */ column-count:4; -moz-column-gap: 1em; -webkit-column-gap: 1em; column-gap: 1em; } /*一个内容层*/ .item{ padding: 1em; margin: 0 0 1em 0; -moz-page-break-inside: avoid; -webkit-column-break-inside: avoid; break-inside: avoid; border: 1px solid #000; } .item img{ width: 100%; margin-bottom:10px; } </style> </head> <body> <div class="container"> <div class="waterfall"> <div class="item"> <img src="http://demo.sc.chinaz.com/Files/DownLoad/webjs1/201804/jiaoben5879/img/01.jpg"> <p>1 convallis timestamp</p> </div> <div class="item"> <img src="http://demo.sc.chinaz.com/Files/DownLoad/webjs1/201804/jiaoben5879/img/10.jpg"> <p>2 convallis timestamp 2 Donec a fermentum nisi. </p> </div> <div class="item"> <img src="http://demo.sc.chinaz.com/Files/DownLoad/webjs1/201804/jiaoben5879/img/07.jpg"> <p>3 Nullam eget lectus augue. Donec eu sem sit amet ligula faucibus suscipit. Suspendisse rutrum turpis quis nunc convallis quis aliquam mauris suscipit.</p> </div> <div class="item"> <img src="http://demo.sc.chinaz.com/Files/DownLoad/webjs1/201804/jiaoben5879/img/11.jpg"> <p> 4 Donec a fermentum nisi. Integer dolor est, commodo ut sagittis vitae, egestas at augue. </p> </div> <div class="item"> <img src="http://demo.sc.chinaz.com/Files/DownLoad/webjs1/201804/jiaoben5879/img/08.jpg"> <p>a fermentum nisi. Integer dolor est, commodo ut sagittis vitae, egestas at augue. </p> </div> <div class="item"> <img src="http://demo.sc.chinaz.com/Files/DownLoad/webjs1/201804/jiaoben5879/img/13.jpg"> <p> 4 Donec a fermentum nisi. Integer dolor est, commodo ut sagittis vitae, egestas at augue. </p> </div> <div class="item"> <img src="http://demo.sc.chinaz.com/Files/DownLoad/webjs1/201804/jiaoben5879/img/10.jpg"> <p>fermentum nisi. Integer dolor est, commodo ut sagittis vitae, egestas at augue. </p> </div> <div class="item"> <img src="http://demo.sc.chinaz.com/Files/DownLoad/webjs1/201804/jiaoben5879/img/05.jpg"> <p> 5 Donec a fermentum nisi. Integer dolor est, commodo ut sagittis vitae, egestas at augue.</p> </div> </div> </div> </body> </html>