2011-08-17 73 views
0

这里的链接: http://www.whiterootmedia.com/homepage_layout_test/浮动权问题

下面的代码:

<body> 


<div class="site" style="background:yellow; "> 

<div class="banner" style="background:blue; height:100px; width:417px; float:left;">Banner Banner Banner Banner Banner </div> 
<div class="ads" style="background:green; height:800px; width:160px; float:right;">Ads Ads Ads Ads Ads Ads Ads Ads Ads </div> 
<div class="tree" style="background:orange; height:400px; width:auto; min-width:417px; clear:left;">Tree Tree Tree Tree Tree Tree </div> 

</div> 


    </body> 

我想绿色格留沿顶,橙色的div内容不走绿色DIV背后,橙色div的最小宽度为417px。预先感谢您提供的任何帮助!

尘埃

+0

重新更新,更简单的修复。 – chris

回答

1

你在你的代码一个错字在这里:

<div class="tree" 
    style="background:orange; height:400px; width:auto; min-width:4170px; clear:left;"> 
    Tree Tree Tree Tree Tree Tree 
</div> 

你设置min-width4170px

将其更改为417px,所有问题都会消失。使用“现场”您

+0

修正了错字,但行为仍然相同... – Dusty

0

div的作为包装/容器 - 设置它的最小宽度到树+宽度的广告的最小宽度 - 417 + 160 = 577px

<div class="site" style="background:yellow; min-width: 577px;"> 

然后,每当你低于这个宽度,它不会在所有事物上拉上绿色的“广告”。如果您将填充/边距添加到树或广告div中,则必须将其添加到容器的最小宽度中。

+0

我不在乎身体的边距/填充/边框。如果你缩小页面,你会看到我在说什么 – Dusty

+0

你是否担心橙色部分内的内容会在广告面板下? – chris

+0

谢谢乔治!这清理了很多,但现在我有第二个问题。假设有橙色的div文字......我怎么才能得到那个文本来将绿色的div推离屏幕。 http://www.whiterootmedia.com/homepage_layout_test/ – Dusty