浅谈CSS满屏品字布局中div设置height为百分比无效的问题
来源:互联网 发布:windows蓝天白云壁纸 编辑:程序博客网 时间:2024/05/15 00:07
满屏品字布局:
<!DOCTYPE html> <html> <head> <title></title> <style> html,body{ margin:0; height:100%; } #top{ width:50%; height:50%; margin:0 auto; background:red; } #left{ width:50%; height:50%; float:left; background:blue; } #right{ width:50%; height:50%; float:left; background:yellow; } </style> </head> <body> <div id="top"></div> <div id="left"></div> <div id="right"></div> </body> </html>
有时候,我们需要将div的高度设置为百分比形式,以便能更好的适配各种屏幕大小,如height:60%。
问题:height:60%无效。
解决办法:添加html, body{ margin:0; height:100%; }。
1 0
- 浅谈CSS满屏品字布局中div设置height为百分比无效的问题
- CSS布局与定位——height百分比设置无效/背景色不显示
- Table布局width设置为百分比无效问题
- CSS--DIV height:100%无效的解决办法
- HTML给div设置百分比高度无效问题
- DIV的CSS height:100%无效的解决办法
- DIV的CSS height:100%无效的解决办法
- DIV的CSS height:100%无效的解决办法
- IE中设置height无效的解决办法
- HTML给div设置百分比高度无效的解决方式
- height百分比无效
- table和div设置height:100%无效的完美解决方法
- table和div设置height:100%无效的完美解决方法
- table和div设置height:100%无效的完美解决方法
- table和div设置height:100%无效的完美解决方法
- table和div设置height:100%无效的完美解决方法
- table和div设置height:100%无效的完美解决方法
- 在 CSS 中如何使用百分比设置页面 Div 高度?
- mysql -h 远程连接权限设置
- epoll详解
- jQuery框架的语法总结下来包括什么?
- freeswitch
- python基础学习(2017/3/1)上午
- 浅谈CSS满屏品字布局中div设置height为百分比无效的问题
- redis持续学习
- select count(*)和select count(1)的区别
- 【Java】线程内存模型,线程、工作内存、主内存
- 【敏捷开发】禅道分工合作 各角色使用说明
- 再见,工作六年的RH公司
- 开启我的博客之旅
- centos下挂载U盘
- 点阵