css样式的展示
2016-05-05 14:20
441 查看
设置成这种展示,思想为一个主的div里面包含3个分的div,由于各个div有边框,故把主div设置成边框的颜色,即为 #f5f5f5
,各个分div由于北京市白色的,设置背景颜色为#fff。每个div通过margin设置宽度,且宽度可以为1.5%,注意
html为:
<div class="main">
<div class='show'><span class='tit'>题目1</span><p class='img'><img src='#'/></p></div>
<div class='show'><span class='tit'>题目2</span><p class='img'><img src='#'/></p></div>
<div class='show'><span class='tit'>题目3</span><p class='img'><img src='#'/></p></div>
</div>
css:
.main{display:none;width: 100%;border-bottom:1px solid #e5e5e5;border-top:1px solid #e5e5e5;background-color: #f5f5f5;margin-top: 8px;overflow: hidden;}
.main div{width:31%;height: 120px; float:left; text-align:center; display:inline;background-color: #fff;box-sizing: border-box;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;}
.main div .tit{font-size:14px;font-weight: bold;padding-top:5%;display:-moz-inline-box; display:inline-block;}
.main div img{width:84%;height:83px;padding-top:5%;padding-bottom:3%;overflow:hidden;}
.main .show:nth-child(1){margin-left:1.5%;margin-right:1%;color:#FFAE2F;}
.main .show:nth-child(2){margin-left:1%;margin-right:1%;color:#FC6868; }
.main .show:nth-child(3){margin-left:1%;margin-right:1.5%;color:#9DD667;}
注:可以通过主div的main类,去掉边框 border-bottom:1px solid #e5e5e5;border-top:1px solid #e5e5e5; 改成
border-bottom:1px ;border-top:1px;即可
相关文章推荐
- Web布局连载——两栏固定布局(五)
- [div+css]晒晒最新制作专题推广页模板
- 盒子模型
- CSS选择器
- CSS样式优先权
- [css] line-height 百分比单位和数值单位的区别
- Apple官网研究之使用Justify布局导航
- 关于前端的思考与感悟
- 设计更快的网页(三):字体和 CSS 调整
- 纯CSS制作的新闻网站中的文章列表
- 10条影响CSS渲染速度的写法与使用建议第1/3页
- BS项目中的CSS架构_仅加载自己需要的CSS
- 很不错的 CSS Hack 又学了一招
- 发一个css比较清爽的写法
- CSS expression控制图片自动缩放效果代码[兼容 IE,Firefox]
- css布局网页水平居中常用方法
- CSS经典技巧十则第1/2页
- css 兼容性问题this.style.cursor=''hand''
- IE6不能正常解析CSS文件问题的解决方法及原因分析