0

我有任何 div 用于显示项目的详细信息(主类)。现在我需要 2 列。右左 。我需要用30px widthand height 100%& 'auto' and修复正确的 div fix in right。左列height:autooverflow:hidden

网页:

<div class="main">
<div class="right">
</div>
<div class="left">
.... Descripton .....
</div>
<div>

CSS:

.main {width:300px; height:auto; overflow:hidden;margin:0 auto;}
.right{width:30px; float:right; height:auto; background-color:#e1e1e1; }
.left{width:270px; float:right; height:auto;}

在线演示我的问题:在这里我没有看到带有背景颜色的右 div:#e1e1e1;

我需要这个:这里

谢谢。

4

3 回答 3

0

您应该使用绝对位置(位置:绝对)。

float:right/left 是一种滥用

<div style="position:relative;width:300px; height:200px;margin:0 auto; background-color:#00ff00;">
 <div style="position:absolute; right:0; top:0;background-color:#ff0000;color:#000;">  Your right content
  </div>
  &nbsp;
  <div style="position:absolute; left:0; top:0;background-color:#0000ff;color:#000;">
    Left content
  </div>
</div>
于 2012-04-08T09:14:43.457 回答
0

所以我相信你想制作两列并排,右列有浅灰色背景。

它们的高度都应该是 100%。为了使东西 100% 高,我们还需要将htmlandbody标记设置为 100%。

我相信这个 jsfiddle 可以满足您的要求。请原谅我稍微改变一下背景颜色,我将左列设置为overflow: auto进行测试。

于 2012-04-08T10:32:54.800 回答
-1

这是一个例子:http: //jsfiddle.net/fbUQB/。这就是你所要求的,不是吗?

于 2012-04-08T10:19:23.043 回答