2011-09-10 33 views
1

考虑你有这样的代码,请阅读评论,因为我认为这将是更容易understant :)当内容扩展时,不能低于div下拉?

<div class="container"> 
<div class="inner_container"> 

<div class="left"> 
This div sometimes expands to the right and pushes right div off the screen 
</div> 

<div class="right"> 
bla bla bla 
</div> 

</div> 
<div id='bottomcontent'> 
This content is below both of the divs, and when div '.right' expands down, I don't want this div pushed down as well, but have the 'right' div go under it/or just make those parts disappear and not push this div down. 
</div> 

</div> 

这是CSS:

.container { 
    width: 796px; 
    overflow:hidden; 
} 
.left { 
    float: left; 
    width: 256px; 
} 
.inner_container{ 
    width: 1396px; 
} 
.right { 
    float: left; 
    width: 796px; 
} 

非常感谢大家,和如果您有任何问题,我会尽我所能解释任何可能会让您感到困惑的东西,谢谢! :)

回答

1

可以使用的位置是:绝对是这样的:

#bottomcontent { 
    position: absolute; 
    top: 30px; 
    left: 256px; /* same as width of .left */ 
    background-color: white; /* if you dont want to see .right through #bottomcontent */ 
} 

jsFiddle

+0

谢谢非常pinouchon :) – pufAmuf

2

我想你可以在这里使用溢出属性。对不起,如果我错了,因为我无法清楚地理解你的上下文。

你可以试试这个:

.left { 
    float: left; 
    width: 256px; 
    overflow:scroll; 
} 

,以避免推右格在屏幕上。

和bottomcontent类,你可以尝试使用的位置是:绝对

+0

感谢Flowerking,这也适用:) – pufAmuf