米
心情
所有
图集
登录
搜索
原创
纯css实现瀑布流布局
米醋儿
发布于:2022-03-30
  瀑布流适合图片多的页面,当然也适合我的速查表页面,这里简单使用css实现一个瀑布流布局。 ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> * { padding: 0; margin: 0; } .content { -moz-column-count: 3; -webkit-column-count: 3; column-count: 3; -moz-column-gap: 1em; -webkit-column-gap: 1em; column-gap: 1em; } .item { height: 60px; padding: 0em; margin-top: 1em; -moz-page-break-inside: avoid; -webkit-column-break-inside: avoid; break-inside: avoid; border: 1px solid #000; background: #909090; } .item:first { margin-top: 0; } .h100 { height: 100px; } .h200 { height: 200px; } </style> </head> <body> <div class="content"> <div class="item"></div> <div class="item"></div> <div class="item h100"></div> <div class="item"></div> <div class="item h200"></div> <div class="item h100"></div> <div class="item h100"></div> <div class="item h100"></div> <div class="item h100"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> </div> </body> </html> ``` 其中请关注3句css ``` column-count: 4; //想要分割的列数 column-gap: 10%; //每列的边距 break-inside: avoid; // auto 指定既不强制也不禁止元素内的页/列中断。 // avoid 指定避免元素内的分页符。 // avoid-page 指定避免元素内的分页符。 // avoid-column 指定避免元素内的列中断。 // avoid-region 指定避免元素内的区域中 ```
注:原创不易,转载请注明出处(
http://micuu.com/new/2721.html
),本站所有资源来源于网络收集,如有侵权请联系QQ245557979进行清除。
最后修改与 2022-03-30
上一篇:
thinkphp6.0模型增删改查速查表
下一篇:
php正则提取markdown中图片
留言反馈
请先登录
问题反馈渠道,如有软件无法下载或者其他问题可反馈。【由于某种原因,目前留言不展示】
用户需要登录后才能留言反馈
立即留言
珍藏视频
10分钟高效燃脂
30天高效瘦脸操
5分钟缓解颈椎操
友人
微博
全民K歌
唱吧
今日头条
悠悠网
科技小锅盖
彼岸桌面
阮一峰
laravel社区
V2ex
掘金
更多>