关键在于添加

overflow: hidden;

padding-bottom:9999px;

margin-bottom:-9999px;

两行:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='keywords' content='' />
<meta name='description' content='' />
<title>两列等高</title>
<style type="text/css">
#wrap{width:500px;margin:0 auto; overflow:hidden;}
#SideBar{width:180px;float:left;border:1px solid #333; padding-bottom:9999px; margin-bottom:-9999px;}
#content{width:300px;float:right; border:1px solid #ccc; padding-bottom:9999px; margin-bottom:-9999px;}
</style>
</head>
<body>
<div id="wrap">
<div id="SideBar">导航<br />栏目名称<br />栏目名称<br />栏目名称<br /></div>
<div id="content">新闻<br />文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容字内容文</div>
</div>
</body>
</html>

简单:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题 1</title>
<style type="text/css">
* {margin: 0; padding: 0;
}body {margin:30px;font:14px/1.6em Verdana, Lucida, Arial, Helvetica, 宋体,sans-serif;
}.main {overflow: hidden; width: 800px; margin: 0 auto;
}.left {float: left; width: 250px; overflow: hidden; background:#FB9D51;
}.center {float:left; margin-left:5px;width:295px; background:#FB9D51;
}.right {float: right; width: 245px; overflow: hidden;background:#FB9D51;
}.equal {padding-bottom: 32767px; margin-bottom: -32767px;
}
</style></head><body>
<div class="main"><div class="left equal"><p>测试一下</p><p>测试一下</p><p>测试一下</p></div><div class="center equal"><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p></div><div class="equal right"><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p></div>
</div>
</body>
</html>

完整:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题 1</title>
<style type="text/css">
*{margin: 0; padding: 0;
}body {margin:30px;font:14px/1.6em Verdana, Lucida, Arial, Helvetica, 宋体,sans-serif;
}.main {overflow: hidden; width: 800px; margin: 0 auto;
}.left {float: left; width: 250px; overflow: hidden;
}.center {float:left;margin-left:5px; width:295px;
}.right {float: right; width: 245px; overflow: hidden;
}.bor_top { height:1px; background:#FB9D51; overflow:hidden;
}.equal {padding-bottom: 32767px; margin-bottom: -32767px;
}.box {background: #F5E2AF; border: 1px #FB9D51 solid; padding-left:10px; padding-right:10px;
}.mt5 {margin-top: 5px;
}</style>
</head>
<body>
<div class="main"><div class="left equal"><div class="box"> <p>你相信这个左右等高的布局是纯的CSS写的吗?</p> </div><div class="box mt5"> <p>来测试一下吧?~!</p> </div><div class="box mt5"> <p>测试一下</p> </div><div class="equal mt5 box"><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p></div></div><div class="center equal"><div class="box"> <p>不由得你不信,这个的确是纯CSS写的</p> </div><div class="box mt5"> <p>来测试一下吧?~!</p> </div><div class="box mt5"> <p>测试一下</p> </div><div class="equal mt5 box"><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p></div></div><div class="equal right"><div class="box"><p>测试一下</p><p>测试一下</p></div><div class="box mt5"><p>测试一下</p><p>测试一下</p><p>测试一下</p></div><div class="box mt5"><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p><p>测试一下</p></div><div class="equal mt5 box"><p>测试一下</p><p>测试一下</p><p>测试一下</p></div></div>
</div>
</body>
</html>

css 布局 两行, 三行等高相关推荐

  1. CSS布局的三个关键属性:float、position、display

    最近在出差,就我一个在这里.客户要做几个页面,涉及到了页面的布局问题,没办法自己得做了.然后就遇到了一些问题.页面不论怎么都不能按照设想的布局. 以前也没有做过网页布局方面的工作.上网上找类似的例子, ...

  2. CSS布局——多列等高布局

    先看一个案例: 左边是导航部分,右边是详细内容,两者的高度都是不固定的.左边导航栏的内容可能比右边的内容高,反之亦然.但是两者的背景颜色高度始终保持一致! 下面进入正题: 1.利用border实现 & ...

  3. CSS布局的三种方式

    绝对定位 绝对定位: ​ 属性:position 值:absolute <style> p.abs{position: absolute;left: 150px;top: 50px; }& ...

  4. 前端笔记(6)css布局机制,浮动,清除浮动,图片格式,ps切片工具及插件

    css样式表/层叠样式表(4) css布局的三种机制 浮动 浮动(float)的扩展 清除浮动 额外标签法(隔墙法) 父级添加overflow属性方法 使用after伪元素清除浮动 使用双伪元素清除浮 ...

  5. CSS布局系列一:标准、浮动、定位

    标准 display block:表示元素占据全部可用宽度的元素,并且在其前后都会换行,常见标签有div.h.p inline:表示元素在一行中水平布置,可以使用水平内边距.边框和外边距.但是,垂直内 ...

  6. css table设置边框_(代码示例)css实现等高布局的三种方式

    本篇文章给大家带来的内容是关于css实现等高布局的三种方式(代码示例),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 本文讲的等高布局是在不手动设置元素高度的情况下,使用纯css实现 ...

  7. 两列布局、三列适应布局、两列等高适应布局。

    一. 两列布局:左侧定宽.右侧自适应. 四种方法 :flex .position.float和负外边距.外边距 1. 使用flex. <!DOCTYPE html> <html> ...

  8. 【CSS布局】已知布局元素的高度,写出三栏布局,要求左栏、右栏宽度各为300px,中间自适应。

    CSS 的布局应该是 CSS 体系中的重中之重了,主要的布局方式有 table 表格布局, flex 盒子布局.float 浮动布局.position 定位布局,grid 网格布局,还有针对于移动端的 ...

  9. css布局:多列等高布局

    多列等高布局是在一个容器里面,并排的多列,如果内容的高度无法在一开始确定(例如内容是动态的),又需要让各列自然地撑开(不出现每列里面的滚动条),这时候需要用css或者js的方法把各列高度设置为最高列的 ...

最新文章

  1. 特征工程之MinMaxScaler、StandardScaler、Normalizer、Binarizer
  2. K-means算法(理论+opencv实现)
  3. 农信计算机资料录入试题,农村信用社考试计算机测试题(一)
  4. docker中部署hadoop、zookeeper、hbase伪分布式并上传到阿里云远程仓库
  5. 机器学习实战--决策树算法
  6. WeScale 技术篇 —— mpvue 与微信小程序的火花
  7. iar stm32_树莓派玩转STM32开发(一)——介绍篇
  8. 南京理工大学计算机学院教授严捍,2019年7月1日学术报告二则(宋巍 教授,南京理工大学;张鹏程 副教授,河海大学)...
  9. java基础—Runtime类使用
  10. div居中以及div中的元素居中
  11. sp_configure
  12. Beta阶段 - 博客链接合集
  13. 不同计算机用户的区别是什么意思,电脑的系统64位和32位是什么意思呢?
  14. 重装Win10系统(加破解)+装Ubuntu18.04双系统
  15. 体重 年龄 性别 身高 预测鞋码_根据一个人的身高和体重能知道他的鞋码吗?
  16. PHP8.0尝鲜系列(一):Windows 10安装PHP8.0
  17. html压缩工具html-minifier -- nodejs常用模块(4)
  18. A. Busiest Computing Nodes
  19. 做了一个淘宝内部优惠券分享平台支持微信公众号以及网站
  20. FPS的瞄准准心的一种写法

热门文章

  1. 信息学奥赛一本通C++语言——1127:图像旋转
  2. linux私有组信息存放在哪,【Linux】Linux私有组,主要组和附加组
  3. 5-2利用MapReduce进行数据排序
  4. Ubuntu下安装JDK1.8并配置开发环境
  5. FastCGI - Getting Request URI and Content in C++ FCGI
  6. 文字滚动插件(css3动画)- 代码篇
  7. 引入Vant-UI全部组件的代码 - (备份)
  8. AdGuard广告拦截插件V3.6.6
  9. java osg_java,osg学习心得
  10. 图像的频率谱和功率谱代表什么_视频/图像质量评价综述(三)