<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > 
<head> 
<title>One Hundred Percent Height divs</title> 
<style type="text/css" media="screen"> 
body { 
margin:0; 
padding:0; 
height:100%; /* this is the key! */ 

#left { 
position:absolute; 
left:0; 
top:0; 
padding:0; 
width:200px; 
height:100%; /* works only if parent container is assigned a height value */ 
color:#333; 
background:#eaeaea; 
border:1px solid #333; 

.content { 
margin-left:220px; 
margin-right:220px; 
margin-bottom:20px; 
color:#333; 
background:#ffc; 
border:1px solid #333; 
padding:0 10px; 

#right { 
position:absolute; 
right:0; 
top:0; 
padding:0; 
width:200px; 
height:100%; /* works only if parent container is assigned a height value */ 
color:#333; 
background:#eaeaea; 
border:1px solid #333; 
}

#left p { 
padding:0 10px; 

#right p { 
padding:0 10px; 

p.top { 
margin-top:20px; 

</style> 
</head>

<body> 
<div id="left"> 
<p class="top">This design uses a defined body height of 100% which allows setting the 
contained left and right divs at 100% height.</p>

<p>This design uses a defined body height of 100% which allows setting the contained left and 
right divs at 100% height.</p>

<p>This design uses a defined body height of 100% which allows setting the contained left and 
right divs at 100% height.</p> 
</div>

<div class="content"> 
<p>This design uses a defined body height which of 100% allows setting the contained left and 
right divs at 100% height.</p> 
</div>

<div class="content"> 
<p>This design uses a defined body height which of 100% allows setting the contained left and 
right divs at 100% height.</p> 
</div>

<div class="content"> 
<p>This design uses a defined body height which of 100% allows setting the contained left and 
right divs at 100% height.</p> 
</div>

<div id="right"> 
<p class="top">To solve an inheritance issue displayed in div #right as rendered in Opera, class p.top 
using margin-top:20; is applied to the first paragraph of each outer divs.</p>

<p>This design uses a defined body height which of 100% allows setting the contained left and 
right divs at 100% height.</p>

<p>This design uses a defined body height which of 100% allows setting the contained left and 
right divs at 100% height.</p> 
</div> 
</body> 
</html>

http://www.webmasterworld.com/forum83/200.htm

来自:

一个DIV三列布局100%高度自适应的好例子(国外)的更多相关文章

  1. CSS学习笔记(6)--浮动,三列布局,高度宽度自适应

    百度ife任务三,要求中间宽度自适应,高度取三列最高者. 开始用position的relative和absolute,但是relative不能自适应宽,absolute不能加float浮动,撑不起来外 ...

  2. 转载 html div三列布局占满全屏(左右两列定宽或者百分比、中间自动适应,div在父div中居底)

    原文地址:http://blog.csdn.net/duyelang/article/details/20558899 <p><!DOCTYPE html> <html ...

  3. 用一个div模拟textarea并实现高度自适应

    1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="U ...

  4. DIV左、中、右三列布局的各类情况说明

    一.中间定宽.左.右侧百分比自适应: 1.HTML代码: <div id="left"> <div id="innerLeft"> &l ...

  5. HTML/CSS学习之 三列布局,其中左侧和右侧的部分宽度固定,中间部分宽度随浏览器宽度的变化而自适应变化

    第一种方法:绝对定位 <!DOCTYPE html> <html> <head> <title>三列布局</title> <link ...

  6. CSS 布局实例系列(三)如何实现一个左右宽度固定,中间自适应的三列布局——也聊聊双飞翼

    今天聊聊一个经典的布局实例: 实现一个三列布局,其中左侧和右侧的部分宽度固定,中间部分宽度随浏览器宽度的变化而自适应变化 可能很多朋友已经笑了,这玩意儿通过双飞翼布局就能轻松实现.不过,还请容我在双飞 ...

  7. DIV+CSS 网页布局之:三列布局

    1.宽度自适应三列布局 三列布局的原理和两列布局的原理是一样的,只不过多了一列,只需给宽度自适应两列布局中间再加一列,然后重新计算三列的宽度,就实现了宽度自适应的三列布局. 同样的道理,更多列的布局, ...

  8. html 三列布局(两列自适应,一列固定宽度)

    不做过多解释:主要是记录一个完整的布局样式,实现页面大致三列其中左右两列是自适应宽度,中间固定宽度效果. 不多少代码奉上: CSS样式代码: /******************** *公共标签样式 ...

  9. CSS三列布局之左右宽度固定,中间元素自适应问题

    最近学到了几种关于左右固定宽度,中间自适应的三列布局的方法,整理了一下,在这里跟大家一起分享分享,其中有什么不足的还望各位给指导指导哈. 首先我想到的是float——浮动布局 使用浮动,先渲染左右两个 ...

随机推荐

  1. MapReduce中TextInputFormat分片和读取分片数据源码级分析

    InputFormat主要用于描述输入数据的格式(我们只分析新API,即org.apache.hadoop.mapreduce.lib.input.InputFormat),提供以下两个功能: (1) ...

  2. 修改php.ini以达到 屏蔽错误信息

    那是因为php.ini中关闭了错误显示,将错误写成了文件,这是人为设置的结果,display_errors =on就好了. 不过不显示错误倒安全点,建议调试时打开,然后提供服务时关闭. 提供一点资料给 ...

  3. 表单元素的写法及与后台php的交互

    1.<select class="textEnaSty" name="Port" size="1" onchange="Ob ...

  4. [OpenJudge 3064]坠落的蚂蚁

    [OpenJudge 3064]坠落的蚂蚁 试题描述 一根长度为1米的木棒上有若干只蚂蚁在爬动.它们的速度为每秒一厘米或静止不动,方向只有两种,向左或者向右.如果两只蚂蚁碰头,则它们立即交换速度并继续 ...

  5. HLG2081分苹果

    苹果 Time Limit: 1000 MS Memory Limit: 32768 K Total Submit: 39(24 users) Total Accepted: 29(22 users) ...

  6. [ruby on rails] 跟我学之(5)显示所有数据

    之前的index页,显示的是hello world,现在将其修改为显示我们在rails console里面录入的数据. 1. 修改action 如之前的章节<[ruby on rails] 跟我 ...

  7. 二模Day2题解

    小明搬家 题目描述 小明要搬家了,大家都来帮忙. 小明现在住在第N楼,总共K个人要把X个大箱子搬上N楼. 最开始X个箱子都在1楼,但是经过一段混乱的搬运已经乱掉了.最后大家发现这样混乱地搬运过程效率太 ...

  8. BADIP filter

    #!/bin/bash touch /tmp/badipnew.log;touch /tmp/newip.log; if [ ! -f "/tmp/badip.log" ];the ...

  9. systemd在各个linux发行版的普及

    后面我要说下自己的意见: 原则如果阻碍了进步,那还算个屁,不客气地说,UNIX 原则已经过时了. 移植性问题:我除了 Mac 外不用任何 BSD 系统,当然 Mac 上一般只做开发不做运维(但就算如此 ...

  10. Minimum Size Subarray Sum

    Given an array of n positive integers and a positive integer s, find the minimal length of a subarra ...