移动端实现瀑布流布局!
程序员文章站
2022-06-03 14:59:07
...
column 多行布局实现瀑布流!
一、html
<div class="waterFall">
<div class="item">
<div class="item_son">
<img class="icon" src="images/[email protected]"/>
<div class="item_img"><img src="images/[email protected]"/></div>
</div>
<div class="item_con">
<div class="item_con_txt">瀑布流布局瀑布流布局瀑布流布局</div>
<div class="item_con_num">评分:12.23</div>
<div class="item_con_dz">点赞数:123</div>
</div>
</div>
<div class="item">
<div class="item_son">
<img class="icon" src="images/[email protected]"/>
<div class="item_img"><img src="images/[email protected]"/></div>
</div>
<div class="item_con">
<div class="item_con_txt">瀑布流布局</div>
<div class="item_con_num">评分:12.23</div>
<div class="item_con_dz">点赞数:123</div>
</div>
</div>
<div class="item">
<div class="item_son">
<img class="icon" src="images/[email protected]"/>
<div class="item_img"><img src="images/[email protected]"/></div>
</div>
<div class="item_con">
<div class="item_con_txt">瀑布流布局瀑布流布局</div>
<div class="item_con_num">评分:12.23</div>
<div class="item_con_dz">点赞数:123</div>
</div>
</div>
<div class="item">
<div class="item_son">
<img class="icon" src="images/[email protected]"/>
<div class="item_img"><img src="images/[email protected]"/></div>
</div>
<div class="item_con">
<div class="item_con_txt">瀑布流布局瀑布流布局瀑布流布局</div>
<div class="item_con_num">评分:12.23</div>
<div class="item_con_dz">点赞数:123</div>
</div>
</div>
</div>
二、css
<style type="text/css">
.waterFall{
width: 7.5rem;
column-count: 2; /*列表 列*/
/*column-gap:0.1rem;*/ /*列表之前的间距*/
padding: 0.15rem;
box-sizing: border-box;
}
.item_con{
padding: 0.1rem;
box-sizing: border-box;
color:midnightblue;
}
.item{
width: 3.44rem;
height: auto;
background: #EBEBEB;
display: flex;
flex-direction: column;
justify-content: center;
break-inside: avoid; /*避免在元素内部断行并产生新列 */
margin-bottom: 0.2rem;
border-radius: 0.08rem;
}
.item_son{
width: 3.44rem;
height: 4.57rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
background: peachpuff;
}
.item_img{
width: 3.44rem;
height: auto;
}
.item_img>img{
width: 100%;
height: 100%;
}
.icon{
position: absolute;
top: 0.2rem;
left: 0.2rem;
width: 0.5rem;
height: 0.5rem;
}
</style>
ps:之前用js总有各种问题,特别是和video一起~
上一篇: C语言中各类型变量在程序中占用内存大小
下一篇: 【设计模式】单例模式的六种实现方式
推荐阅读
-
jQuery向下滚动即时加载内容实现的瀑布流效果_PHP
-
js实现兼容PC端和移动端滑块拖动选择数字效果
-
js实现移动端微信页面禁止字体放大
-
移动端页面布局技巧、Grid布局基础知识
-
[PHP]移动端网页如何使用JqueryMobile+PHP实现上传图片的功能
-
[PHP]移动端网页如何使用JqueryMobile+PHP实现上传图片的功能
-
HTML-移动端如何使用css让百分比布局的弹窗水平和垂直方向上居中_html/css_WEB-ITnose
-
javascript实现瀑布流加载图片原理_javascript技巧
-
Vue.js 的移动端组件库mint-ui实现无限滚动加载更多的方法
-
如何做出vue移动端实现下拉刷新功能