css+js瀑布流内容高度自适应
来源:互联网 发布:gh0st源码分析 编辑:程序博客网 时间:2024/06/03 05:53
直接上代码,来不及解释了。↓↓↓
/** * 设置瀑布流的高度为窗体高度 */$("#content").height($(window).height());
<div id="content"> <div id="imgM" class="trip-bg" ng-click="openModal(businessTypeList[2])"> <div class="centered"> <i class="icon img trip-png"></i> <p class="light">出差申请</p> </div> </div> <div id="imgM" class="attendance-bg" ng-click="openModal(businessTypeList[6])"> <div class="centered"> <i class="icon img attendance-png"></i> <p class="light">考勤补登记</p> </div> </div> ...........还有很多小盒子省略</div>**css**样式↓#content{ -webkit-column-count: 3; -moz-column-count: 3; column-count: 3; -moz-column-gap:0px; -webkit-column-gap:0px; column-gap:0px; padding: 10px;}.img{background-size:100% 100%;display: inline-block;position: relative;height: 50px;width: 50px;margin: 0px 0px 0px 0px;}#imgM { position: relative; padding: 5px; text-align: center; border: solid 1px #eeeeee; border-radius: 4px; cursor: pointer; width: 100%; break-inside:avoid; box-sizing: border-box;}.trip-bg{ background: url(../img/operationCenter/trip_bg.jpg) no-repeat center; height: 25%;}.trip-png{ background-image: url(../img/operationCenter/trip_img.png);}.attendance-bg{ background: url(../img/operationCenter/attendance_bg.jpg) no-repeat center; height: 25%;}.attendance-png{ background-image: url(../img/operationCenter/attendance_img.png);}
.centered { position: relative; top: 50%; margin-top: -43px;}
通过jquery来设置整个瀑布流盒子高度为窗体高度,而每列内的小盒子高度则用百分比,百分之只和一定得是100%,或者说每列盒子的百分比数一定相等。这样就可以底部等高,而不会出现参差不齐了。
最后来张效果图↓
阅读全文
0 0
- css+js瀑布流内容高度自适应
- RecyclerView实现瀑布流,图片自适应高度
- JS控制自适应瀑布流
- Js瀑布流-自适应宽度
- js实现textarea高度根据内容自适应
- js实现textarea高度根据内容自适应
- 奇怪的问题,关于js+css实现页面内容高度自适应的两种解决方案
- 使用RecyclerView实现的瀑布流高度自适应
- 使用RecyclerView实现的瀑布流高度自适应
- [置顶] RecyclerView实现瀑布流,图片自适应高度
- css中解决textarea高度随内容自适应的问题
- iframe 自适应内容高度
- iframe 自适应内容高度
- UITableViewCell自适应内容高度
- iframe高度自适应内容
- iframe高度自适应内容
- UIWebView自适应内容高度
- Item高度自适应内容
- C币获取
- ELF格式文件符号表全解析及readelf命令使用方法
- C语言基础练习3
- 12.Java静态变量与常量
- 连接池c3p0 ,Proxool ,Druid ,Tomcat Jdbc Pool对比测试
- css+js瀑布流内容高度自适应
- 第五周 【项目4
- [FAQ18312]L版本开启SD SWAP, 预置第三方应用到/data/app,apk移至SD卡必现失败
- Matlab 三角函数(sin)
- PullToRefresh的实现上拉刷新下拉加载
- 遗传算法深入学习中
- Pyhon—生成随机数
- 【tensorflow 学习】给LSTM加上L2正则化
- Java的简单输入输出问题