简体   繁体   English

为什么我的浮动左div使用960.gs转到IE6中的下一行?

[英]Why does my floated left div go to the next line in IE6 using the 960.gs?

I'm using the 960 grid system to make a site (www.960.gs). 我正在使用960网格系统制作网站(www.960.gs)。

I have a 9 column wide div (grid_9) with two divs inside it (grid_5 and grid_4). 我有一个9列宽的div(grid_9),里面有两个div(grid_5和grid_4)。

This is meant to yield one large outer div with 2 internal divs sitting side by side inside of it. 这意味着产生一个大的外部div,其中2个内部div并排坐在其中。

However when viewed in IE6 it displays as one larger div with two internal divs, one below the other. 但是,在IE6中查看时,它显示为一个较大的div,具有两个内部div,一个在另一个div之下。

In Firefox the divs sit next to each other, as they are meant to, and the same setup works fine in other parts of the site. 在Firefox中,这些div按其原本的意图并排放置,并且该设置在网站的其他部分也可以正常使用。

What is going on? 到底是怎么回事? I can't work it out. 我无法解决。

Here is the html: 这是html:

<div class="ContentWrapper grid_9 alpha omega">
        <div id="MainTitleWrapper" class="standardColor">
            <h2><span class="Rating"><%=Model.Rating%></span><%=Model.ScreenName%></h2>
        </div>
        <div class="MainContentWrapper standardColor">
            <div class="grid_5 alpha">
                    <h3>Ranked This Week In:</h3>
                    <div class="TagContentList">
                        <ul> some stuff</ul>
                    </div>
            </div>
            <div class="grid_4 omega">
                    <h3>Latest</h3>
                    <div class="tweet">
                    </div>
            </div>
        </div>
    </div>

Without being able to see more of what's going on, I'd guess the content of your internal divs is pushing their width to be larger than their container. 在看不到正在发生的事情的更多情况下,我猜您内部div的内容会将其宽度推到大于其容器的宽度。 IE6 doesn't respect a container's width designation if the content pushes that width at all. 如果内容完全压住了该宽度,则IE6将不遵守容器的宽度指定。

But do post more code or a link if you can! 但是,如果可以,请发布更多代码或链接!

The line: 该行:

"and the same setup works fine in other parts of the site." “并且相同的设置在网站的其他部分也可以正常工作。”

Would lead me to look at the padding, margins and width of the content within the grid_4 and grid_5 divs, from what I remember the box model is pretty flaky in IE6. 让我看一下grid_4和grid_5 div 内容的填充,边距和宽度,从我记得IE6中的盒子模型来看,这个模型很不可靠。

Also IE6 (and possibly later) has a problem in that italic content is always wider than you expect and could lead to the outer div (grid_4 or grid_5) being wider than you expect. IE6(可能还有更高版本)也存在一个问题, 斜体内容始终比您期望的宽,并且可能导致外部div(grid_4或grid_5)比您期望的宽。

Could be something as simple as IE6's propensity to double-pad. 可能像IE6的双键盘一样简单。 If you dare present the 960 grid system with a hack, try this: 如果您敢为960网格系统提供一些技巧,请尝试以下操作:

padding: 10px; /* whatever the padding is supposed to be for normal browsers */
_padding: 5px; /* half of that for IE6 */

IE6 will render the _padding rule - other browsers will not. IE6将呈现_padding规则-其他浏览器则不会。 This works for any rule: normal style rule, first; 这适用于任何规则:常规样式规则,第一; IE6 _rule, after. IE6 _rule,之后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM