Suckerfish 的奇怪儿子 ie6/ie7 问题 - 最右侧下拉菜单中的 2 个字母也出现在屏幕左侧

发布于 2024-08-30 23:38:43 字数 3791 浏览 7 评论 0原文

我正在印度的一个非政府组织实习,并试图修复他们的网站,包括更新他们的菜单,这样它就不是页面上加载的最后一个项目,并且它位于屏幕中央。一切都运行良好,但是当我在 IE6 中尝试我的新菜单时,我收到一个奇怪的错误,其中菜单下方的内容额外填充了 30px 左右,并且最右侧下拉列表中的材质出现在菜单的最左侧。屏幕,始终可见。当我下拉最右边的链接(“出版物”)时,内容会显示在正确的位置和屏幕最左侧的同一位置,并且当我悬停时也会改变颜色。这很难描述,所以最好看一下:

访问 http://sevamandir。 org/a30/aboutus.htm 在您的 IE6/IE7 浏览器中亲自查看。我真的很感谢你的帮助。另外,我使用的是 1000 像素宽的显示器,如果在该空间之外有更多的狂欢,我也想知道。

我又看了一遍这个问题,发现比我想象的还要奇怪。无论最左侧的下拉菜单中有多少项目,仅显示最底部下拉菜单项的两个字母。当我删除最左侧的下拉菜单时,下一个最左侧项目的底部项目会显示在同一空间中。菜单和内容之间的填充始终相同。当我将鼠标悬停在实际菜单项上时,左侧的两个字母会更改颜色以匹配悬停颜色。

不幸的是,许多访问我们网站的人都使用旧浏览器,因此 IE6 支持非常重要,但这个问题确实很奇怪,我希望得到一些帮助。

我在 http://sevamandir 上上传了一个包含整个 style.css 表的文件和下面的 HTML 代码.org/a30/aboutus.htm

这是相关的代码:

在 html head 中:

<script>
sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
        this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
        this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
</script>

菜单周围的文本 - 菜单很简单

<ul id="nav"><li></li></ul>

等。

<!--begin catchphrase-->
    <div style="float:left; height:27px; width:520px; margin:0px; font:16px Arial, Helvetica, sans-serif; font-weight:bold; color:#769841;">
        Transforming lives through democratic &amp; participatory development
    </div>

    <?php include("menu.php"); ?>

    </div><!-- end header -->
<!--begin main text div-->
<div id="maincontent">

相关菜单 CSS:

#nav, #nav ul {
font:bold 11px Verdana, sans-serif;
float: left;
width: 980px;
list-style: none;
line-height: 1;
background: white;
font-weight: bold;
padding: 0;
border: solid #769841;
border-width: 0;
margin: 0 0 1em 0;
}

#nav a {
display: block;
width: 140px;           /*this is the total width of the upper menu*/
w\idth: 120px;          /*this is the width less horizontal padding */
padding: 5px 10px 5px 10px; /*horiz padding is the 2nd & 4th items here - goes Top Right Bottom Left */
color: #ffffff;
background:#b6791e;
text-decoration: none;

}

#nav a.daddy {
background: url(rightarrow2.gif) center right no-repeat;
}

#nav li {
float: left;
padding: 0;
width: 140px;           /*this needs to be updated to match top #nav a */
background:#b6791e;
}

#nav li:hover, #nav li a:hover, #nav li:hover a {
background:#769841;
}

#nav li:hover li a {
    background:#ffffff;
    color:#769841;
}



#nav li ul {
    position: absolute;
    left: -999em;
    height: auto;
    width: 14.4em;
    w\idth: 13.9em;
    font-weight: bold;
    border-width: 0.25em;       /*green border around dropdown menu*/
    margin: 0;
}

#nav li ul a {
    background:#ffffff;
    color:#769841;
}

#nav li li {
    padding-right: 1em;
    width: 13em;
    background:#ffffff;
}

#nav li ul a {
    width: 13em;
    w\idth: 9em;
}

#nav li ul ul {
    margin: -1.75em 0 0 14em;
}

#nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul {
    left: -999em;
}

#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul {
    left: auto;
}

#nav li:hover, #nav li.sfhover, {
    background: #769841;
    color:#ffe400;
}

#nav li a:hover, #nav li li a:hover, #nav li:hover li:hover, #nav li.sfhover a:hover {
    background: #769841;
    color:#ffe400;
}

I'm interning for an NGO in India and trying to fix their website, including updating their menu so it's not the last item on the page to load, and it's centered on the screen. Everything works well enough but when I try out my new menu in IE6, I get this weird error where the content below the menu is padded an extra 30px or so and the material in the right-most drop down appears on the far left of the screen, always visible. When I drop down the rightmost link ("Publications") the content appears both in the correct location and in the same spot on the far left of the screen, and changes color when I hover as well. It's tough to describe, so it would probably be best if you took a look:

visit http://sevamandir.org/a30/aboutus.htm in your IE6/IE7 browser to see for yourself. I really appreciate your help. Also I'm using a 1000px wide monitor, if there's more hijinks going on outside that space I'd like to know about that too.

I took a look at the problem again and it's even weirder than I thought. Only two letters of the bottom-most drop down menu item are shown, no matter how many items are in the left-most drop down menu. When I delete the left-most drop down menu, the bottom item from the next left-most item shows up in the same space. The padding between the menu and the content is always the same. When I hover over the real menu item, the two letters on the left hand side change color to match the hover color.

Unfortunately many people that visit our website are using old browsers so IE6 support is pretty crucial, this problem is really weird though, and I would appreciate some help.

I uploaded a file with the entire style.css sheet in the and HTML code below, at http://sevamandir.org/a30/aboutus.htm.

Here's the relevant code:

in the html head:

<script>
sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
        this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
        this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
</script>

text surrounding the menu - the menu is simply

<ul id="nav"><li></li></ul>

etc.

<!--begin catchphrase-->
    <div style="float:left; height:27px; width:520px; margin:0px; font:16px Arial, Helvetica, sans-serif; font-weight:bold; color:#769841;">
        Transforming lives through democratic & participatory development
    </div>

    <?php include("menu.php"); ?>

    </div><!-- end header -->
<!--begin main text div-->
<div id="maincontent">

Relevant menu CSS:

#nav, #nav ul {
font:bold 11px Verdana, sans-serif;
float: left;
width: 980px;
list-style: none;
line-height: 1;
background: white;
font-weight: bold;
padding: 0;
border: solid #769841;
border-width: 0;
margin: 0 0 1em 0;
}

#nav a {
display: block;
width: 140px;           /*this is the total width of the upper menu*/
w\idth: 120px;          /*this is the width less horizontal padding */
padding: 5px 10px 5px 10px; /*horiz padding is the 2nd & 4th items here - goes Top Right Bottom Left */
color: #ffffff;
background:#b6791e;
text-decoration: none;

}

#nav a.daddy {
background: url(rightarrow2.gif) center right no-repeat;
}

#nav li {
float: left;
padding: 0;
width: 140px;           /*this needs to be updated to match top #nav a */
background:#b6791e;
}

#nav li:hover, #nav li a:hover, #nav li:hover a {
background:#769841;
}

#nav li:hover li a {
    background:#ffffff;
    color:#769841;
}



#nav li ul {
    position: absolute;
    left: -999em;
    height: auto;
    width: 14.4em;
    w\idth: 13.9em;
    font-weight: bold;
    border-width: 0.25em;       /*green border around dropdown menu*/
    margin: 0;
}

#nav li ul a {
    background:#ffffff;
    color:#769841;
}

#nav li li {
    padding-right: 1em;
    width: 13em;
    background:#ffffff;
}

#nav li ul a {
    width: 13em;
    w\idth: 9em;
}

#nav li ul ul {
    margin: -1.75em 0 0 14em;
}

#nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul {
    left: -999em;
}

#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul {
    left: auto;
}

#nav li:hover, #nav li.sfhover, {
    background: #769841;
    color:#ffe400;
}

#nav li a:hover, #nav li li a:hover, #nav li:hover li:hover, #nav li.sfhover a:hover {
    background: #769841;
    color:#ffe400;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北方。的韩爷 2024-09-06 23:38:43

问题是 IE Ghost 文本错误,这是由于浮动项之间的 HTML 注释标记过多而引起的。在这里阅读更多信息 http://www.toastedweb.si/docs/ie_ghost_text_bug_fix.html

The problem was the IE Ghost text bug, which is caused by having too many HTML comment tags between floated items. Read more here http://www.toastedweb.si/docs/ie_ghost_text_bug_fix.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文