作者elan (岚)
看板Web_Design
标题Re: [问题] 关於css的区块问题
时间Wed Jun 21 02:57:47 2006
※ 引述《xacid ( )》之铭言:
: 我想到的是直接用绝对定位排。以这样的 html 为例:
: <div id="main">
: <div id="left">...</div>
: <div id="right">...</div>
: </div>
: 把 #left 设成 position: absolute ,然後设定上下距都是 0 就行了,像这样:
: #main{
: position: relative;
: margin: 0 auto 0 auto;
: width: 780px;
: }
: #left{
: position: absolute;
: width: 180px;
: top:0; bottom:0;
: background-color: #168;
: color:#fff;
: padding: 10px;
: }
: #right{
: margin-left: 200px;
: padding: 10px;
: line-height: 1.5em;
: background-color: #eee;
: }
用绝对定位来做排版是很直觉且简单
但是 ...
最大的缺点就是绝对定位让你的element跳脱了正常element flow而失去了layout上的弹性
我用你的code写了一个例子
http://elanhung.50webs.com/example03.html
在这种情况下就没办法达到原先要求的等高视觉效果
采用float model才可以保持layout上的弹性
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.131.2.149