div两栏等高布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>div两栏等高布局</title>
<style type="text/css">
*{
padding: 0;margin: 0;text-align: center;
}
.header,.footer{
padding: 10px 0;width: 100%;background: #eee;font-size: 20px;
}
.wrap{
width: 100%;
margin: 0 auto;
overflow: hidden;
display: inline-block;
}
.wrap:after{
display: block;
content:'[DO NOT LEAVE IT IS NOT REAL]';
height: 0;clear:both;
visibility: hidden;
}
.left{
width: 30%;float: left;background: #fff;text-align: left;
}
.right{
width: 70%;float: left;background: #0278b5;
}
.left,.right{
padding-bottom: 32767px !important;
margin-bottom: -32767px !important;
}
@media all and(min-width:0px){
.left,.right{
margin-bottom: 0px !important;
padding-bottom: 0px !important;
}
.left:before,.right:before{
content:'[DO NOT LEAVE IT IS NOT REAL]';
display: block;
background: inherit;
padding-top: 32767px !important;
margin-bottom: -32767px !important;
height:0;
}
}
.footer{
float: left;
}
</style>
</head>
<body>
<div class="wrap">
<div class="header">
<h1>header</h1>
</div>
<div class="left">
<h2>sideleft</h2>
左上
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
左下
</div>
<div class="right">
<h2>sideright</h2>
右上
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
右下
</div>
</div>
<div class="footer">
<h1>footer</h1>
</div>
</body>
</html>
注释:
content 属性与 :before 及 :after 伪元素配合使用,来插入生成内容。
例如a:after{content:‘[DO NOT LEAVE IT IS NOT REAL]'}则会在链接后面加上[DO NOT LEAVE IT IS NOT REAL]文本;
32767应该是动态脚本生成,为16位有符号整数最大值,没有太大意义
机器字长为16位,则无符号数的表示范围是0-65535,有符号位的表示范围:-32767-32767(此数值对应原码表)
1000-0 (15个0)这个数因为是补码表示,所以
它不是0,而是:-2的15次方=-32768.
这个是最小的;
最大到:
0111-1 (15个1) =2的15次方-1
=32767
第二种
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/details.css">
<!-- // <script type="text/javascript" src="js/index.js"></script> -->
<style type="text/css">
/* .container {width:960px; height:100%; overflow:hidden; margin:0 auto;}
.left {height:100%; width:200px; overflow:hidden; padding-bottom:9999px; margin-bottom:-9999px; float:left; display:inline;}
.right {width:750px; float:right; height:auto;}*/
#content{overflow:hidden;}
.left{width:200px; margin-bottom:-3000px; padding-bottom:3000px; background:#cad5eb; float:left;}
.right{width:400px; margin-bottom:-3000px; padding-bottom:3000px; background:#f0f3f9; float:right;}
/*.center{margin:0 410px 0 210px; background:#ffe6b8; height:600px;}*/
</style>
</head>
<body>
<!-- <div class="container">
<div class="left" style="background:red"></div>
<div class="right" style="background:pink"></div>
</div> -->
<div id="content">
<div class="left">左边,无高度属性,自适应于最高一栏的高度
</div>
<div class="right">右边,无高度属性,自适应于最高一栏的高度
<br>
<br>
<br>
<br>
<br>
</div>
<div class="center">中间,高度600像素,左右两栏的高度与之自适应</div>
</div>
</body>
</html>
div两栏等高布局的更多相关文章
- CSS display:table属性用法- 轻松实现了三栏等高布局
display:table:此元素会作为块级表格来显示(类似 <table>); display:table-cell属性指让标签元素以表格单元格的形式呈现,类似于td标签.目前IE8+以 ...
- 【CSS】三栏/两栏宽高自适应布局大全
页面布局 注意方案多样性.各自原理.各自优缺点.如果不定高呢.兼容性如何 三栏自适应布局,左右两侧300px,中间宽度自适应 (1) 给出5种方案 方案一: float (左右浮动,中间不用给宽,设置 ...
- CSS+DIV两栏式全屏布局
在网上找了很久,发现大部分都是固定宽度设置两栏,全屏情况下的布局很少.最后终于完成了,写出来备查,也供大家参考. <!DOCTYPE html PUBLIC "-//W3C//DTD ...
- 多种方法实现div两列等高(收集整理)
HTML骨架 <div id="header">头部</div> <div id ="container"> <div ...
- 纯css实现div三列等高布局的最简单方法简化版/也可以多列
使用正padding和负margin对冲实现多列布局方法 这种方法很简单,就是在所有列中使用正的上.下padding和负的上.下margin,并在所有列外面加上一个容器,并设置overflow:hid ...
- css两列等高布局
布局方案 等高布局有几种不同的方法,但目前为止我认为浏览器兼容最好最简便的应该是padding补偿法.首先把列的padding-bottom设为一个足够大的值,再把列的margin-bottom设一个 ...
- 两列等高布局 padding+margin的负值 CSS布局奇淫技巧之-多列等高
代码: 效果图: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/ ...
- 利用jQuery进行三行两列等高布局
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- CSS 实现:两栏布局(等宽布局)
☊[实现要求]:两栏等宽布局 <div class="demo3"> <div class="col-1"></div> & ...
随机推荐
- 创建基于Bootstrap的下拉菜单的DropDownList的JQuery插件
Bootstrap是当下流行的前端UI组件库之一.利用Bootstrap,可以很方便的构造美观.统一的页面.把设计师从具体的UI编码中解放出来. Bootstrap提供了不少的前端UI组件.带下拉 ...
- Codeforces Round #283 Div.2 D Tennis Game --二分
题意: 两个人比赛,给出比赛序列,如果为1,说明这场1赢,为2则2赢,假如谁先赢 t 盘谁就胜这一轮,谁先赢 s 轮则赢得整个比赛.求有多少种 t 和 s 的分配方案并输出t,s. 解法: 因为要知道 ...
- 阿里云+wordpress搭建个人博客网站【小白专用的图文教程】
[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/4 ...
- POJ1426Find The Multiple[BFS]
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 27433 Accepted: 114 ...
- ural Cipher Message
Cipher Message Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Desc ...
- java 22 - 15 死锁的问题
同步的弊端: A:效率低 B:容易产生死锁 死锁: 两个或两个以上的线程在争夺资源的过程中,发生的一种相互等待的现象. 举例: 中国人,美国人一起吃饭. 正常情况: 中国人:筷子两支 美国人: ...
- sql将同一个表中的两列Int数据相加,有些数据是空的
不能这样加! 有些数据为null吧,null+任何值=null 如这句话就不行 update HY_MYGGCYSWCQKB set HY_MYGGCYSWCQKB.Sj_By_Sr=HY_MYGGC ...
- HTML-学习笔记(属性)
HTML属性 HTML 标签可以拥有属性.属性提供了有关HTML元素更多的信息. 属性总是以键值对的形式出现.例如 name = "value"; 属性总是在HTML元素的开始标签 ...
- AngularJs 时间格式化处理
1.AngularJs的controller中格式: var dateAsString = $filter('date')(item_date, "yyyy-MM-dd hh:mm:ss&q ...
- Centos5.8下编译安装PHP5.4和memcached, phalcon, yaf, apc
安装GIT 需要先安装gcc-c++ (sudo yum install gcc-c++)sudo yum install gettext-devel expat-devel cpio perl op ...