常见css垂直自适应布局(css解决方法)
- css3的盒模型,
css3中添加弹性盒模型,最新弹性盒模型是flex,之前为box
<!DOCTYPE html>
<html >
<head>
<title>div + css宽度自适应(液态布局)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
/*左边栏,设定宽度*/
html,body{
width: 100%;
height: 100%;
margin: 0;
}
#wrap{
display: flex;
width: 100%;
height: 100%;
/*css3 的盒模型设置垂直排序 新老方法 box-orient老方法 flex-direction新方法*/
box-orient:vertical;
flex-direction:column;
}
.wrap_l
{
height: 150px;
width: 150px;
background: yellow;
}
/*中间栏,宽度auto,*/
.wrap_m
{
flex:1;
background: blue;
}
</style>
</head>
<body>
<div id="wrap">
<div class="wrap_l">
这是上边部分<br />
这是上边部分<br />
这是上边部分
</div>
<div class="wrap_m">
这是下部分
</div>
</div>
</body>
</html>
2.position: absolute;绝对布局解决方案
绝对布局主要相对它的父dom做的操作,一般父dom要有足够的空间,如果涉及嵌套太多,父dom可以设置为postion:relative
<!DOCTYPE html>
<html >
<head>
<title>div + css宽度自适应(液态布局)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
/*左边栏,设定宽度*/
html,body{
width: 100%;
height: 100%;
margin: 0;
}
#wrap{
width: 100%;
height: 100%;
}
.wrap_l
{
height: 150px;
width: 150px;
background: yellow;
}
/*中间栏,宽度auto,*/
.wrap_m
{
position: absolute;
top:150px;
width: 100%;
background: blue;
bottom: 0px;
}
</style>
</head>
<body>
<div id="wrap">
<div class="wrap_l">
这是上边部分<br />
这是上边部分<br />
这是上边部分
</div>
<div class="wrap_m">
这是下部分
</div>
</div>
</body>
</html>
3.table布局
也可以用display:table仿table布局
display:table只支持IE8+以上
<!DOCTYPE html>
<html >
<head>
<title>div + css宽度自适应(液态布局)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
/*左边栏,设定宽度*/
html,body{
width: 100%;
height: 100%;
margin: 0;
}
#wrap{
width: 100%;
height: 50%;
display: table;
}
.wrap_l
{
height: 100px;
display: table-row;
background: yellow;
}
/*中间栏,宽度auto,*/
.wrap_m
{
display: table-row;
background: blue;
}
</style>
</head>
<body>
<div id="wrap">
<div class="wrap_l">
这是上边部分<br />
这是上边部分<br />
这是上边部分
</div>
<div class="wrap_m">
这是下部分
</div>
</div>
<table style="height:50%;width:100%">
<tr style="background: red;height:100px"><td > 上部分</td></tr>
<tr style="background: yellow;"><td > 下部分</td></tr>
</table>
</div>
</body>
</html>
这就最终的结果

常见css垂直自适应布局(css解决方法)的更多相关文章
- DIV+CSS布局中自适应高度的解决方法
div乱跑问题 (文件<DIV+CSS布局中自适应高度的解决方法.rar>) float 是个很危险的东西 得小心使用 本来有一很好的关于CSS+DIV的论坛 不过现在关门了 甚是可 ...
- CSS流体(自适应)布局下宽度分离原则
CSS流体(自适应)布局下宽度分离原则 这篇文章发布于 2011年02月28日,星期一,00:48,归类于 css相关. 阅读 73990 次, 今日 5 次 by zhangxinxu from h ...
- CSS+DIV自适应布局
CSS+DIV自适应布局 1.两列布局(左右两侧,左侧固定宽度200px;右侧自适应占满) 代码如下: <!doctype html> <html> <head> ...
- 演示:纯CSS实现自适应布局表格
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- PHP开发中常见的安全问题详解和解决方法(如Sql注入、CSRF、Xss、CC等
页面导航: 首页 → 网络编程 → PHP编程 → php技巧 → 正文内容 PHP安全 PHP开发中常见的安全问题详解和解决方法(如Sql注入.CSRF.Xss.CC等) 作者: 字体:[增加 减小 ...
- easyui 中iframe嵌套页面,大弹窗自适应居中的解决方法。$('#win').window()
easyui 中iframe嵌套页面,大弹窗自适应居中的解决方法.$('#win').window() 以下是左边栏和头部外层遮罩显示和隐藏方法 /*外层 遮罩显示*/ function wrapMa ...
- javascript常见的20个问题与解决方法
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 常见css水平自适应布局
左右布局,左边固定,右边自适应布局 BFC方法解决 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ...
- CSS兼容性问题总结及解决方法
css兼容问题 兼容问题 1.文字本身的大小不兼容.同样是font-size:14px的宋体文字,在不同浏览器下占的空间是不一样的,ie下实际占高16px,下留白3px,ff下实际占高17px,上留白 ...
随机推荐
- mysql 快速简单安装法
网上下载的编译好的包 最好安装在 /usr/local 目录下面: 我用的mysql的版本的是:mysql--linux-i686-icc-glibc23.tar.gz 在官网上就可以下载到. 先期工 ...
- Visual Studio 版本转换工具WPF版开源了
想法的由来 入职一家新公司,领导给了个任务,要编写一个视频监控软件,等我编写调试好,领导满意了以后,这个软件要加入到公司的一个软件系统中去(这个添加工作不用我来做,嘻嘻,看着自己的软件被别人使用,心情 ...
- UvaLA 3938 "Ray, Pass me the dishes!"
"Ray, Pass me the dishes!" Time Limit: 3000MS Memory Limit: Unkn ...
- acm的ubuntu (ubuntu16.04 安装指南,chrome安装,vim配置,git设置和github,装QQ)
日常手贱把ubuntu14.04更新到了16.04,然后就game over了.mdzz,不然泥萌也看不到这篇博客了=.= 然后花了些时间重装了一个16.04版的,原来那个14.04的用可以用,就是动 ...
- 搭建Apache Web服务器
1.下载Apache服务器的安装包 地址:http://httpd.apache.org/download.cgi 从http://archive.apache.org/dist/httpd/bina ...
- 双向数据绑定(angular,vue)
最近github上插件项目更新了关于双向数据绑定的实现方式,关于angular和vue. angular众所周知是使用的脏检查($dirty).一开始大家会认为angular开启了类似setInter ...
- C#操作mysql数据库
转 http://www.jb51.net/article/43486.htm using System;using System.Configuration;using MySql.Data.My ...
- WebService -- Java 实现之 CXF ( 使用:Spring+CXF+Tomcat发布webService)
1. 新建一个Maven项目,选择webapp模板,命名为WS_Spring_CXF_Tomcat 2. 在POM.xml中添加Spring和CXF的依赖 <!-- 添加 Spring depe ...
- C#中的 特性 详解(转载)
本篇幅转载于:http://www.cnblogs.com/rohelm/archive/2012/04/19/2456088.html C#中特性详解 特性提供了功能强大的方法,用于将元数据或声明信 ...
- GPS 气压计高度测量
气压计测某个点的高度是不准的,因为天气.温度等原因会导致不同时刻同一地点气压不同,所以气压计测量不准.但气压计测量相对高度是很准的.GPS测相对高度不准,但测定点高度比较准.