页面布局常用,让子级div排排坐
2017-07-04 17:46
134 查看
画页面的时候经常遇到页面布局的问题,父级div包裹多个子div很常见,代码如下:
但是效果如下:
如果我想让多个子div横着排排坐,加 float:left 这个是个办法。
另一种办法是,给父级div加 display:table,然后给子div加 display:table-cell;
<div> <div style='width:100px;height: 100px;background: rgb(23,121,78);'></div> <div style='width:100px;height: 100px;background: rgb(12,121,67);'></div> <div style='width:100px;height: 100px;background: rgb(21,121,12);'></div> <div style='width:100px;height: 100px;background: rgb(124,121,121);'></div> </div>
但是效果如下:
如果我想让多个子div横着排排坐,加 float:left 这个是个办法。
另一种办法是,给父级div加 display:table,然后给子div加 display:table-cell;
<div style='display: table;'> <div style='width:100px;height: 100px;background: rgb(23,121,78);'></div> <div style='width:100px;height: 100px;background: rgb(12,121,67);display:table-cell;'></div> <div style='width:100px;height: 100px;background: rgb(21,121,12);display:table-cell;'></div> <div style='width:100px;height: 100px;background: rgb(124,121,121);display:table-cell;'></div </div>
相关文章推荐
- DIV+CSS页面布局中注意的问题以及常用的CSS使用方法
- Web_CSS_DIV_网页页面常用布局
- DIV+CSS页面布局中注意的问题以及常用的CSS使用方法
- 精通CSS.DIV网页样式与布局(四) ——页面背景
- App引导页面的常用布局和实现
- <div+css页面布局课堂笔记>2---页面布局的盒子模型
- <div+css页面布局课堂笔记>9---页面布局网站首页设计实例__1
- DIV+CSS布局入门示例(一)页面布局与规划
- 利用div的定位制作复杂的页面布局
- div和table页面布局的区别
- CSS/DIV页面布局----
- DIV+CSS常用的Html网页布局代码
- [转]如何用div+css布局页面
- 一小时搞定DIV+CSS布局-固定页面开度布局
- 简洁 DIV+CSS布局入门之三 ( DIV+CSS常用 常用CSS DIV+CSS实例 简单DIV+CSS DIV+CSS布局分析 DIV+CSS流程)
- 收藏网站制作常用经典css.div.布局.设计实例打包下载2
- DIV和table页面布局的区别和联系
- DIV+CSS布局入门示例(一)页面布局与规划
- CSS + DIV 布局(页面居中)
- Div+CSS布局入门教程(1)页面布局与规划