IE 空白类似错误,但不是空白错误
我在这里设置了 CSS 菜单:
问题是,我注意到IE 无法正确显示菜单,现在我又回到使用 IE8 的电脑来修复它。我正在使用兼容模式。
我注意到两个问题。在子菜单上(例如“资源中心”),每个项目之间有额外的间距,当您的光标穿过它时,菜单将关闭。这听起来像是 IE 空白错误,但我使用 PHP 去除了空白。如果我使用 float:left;clear:left;它会导致 Firefox 和 IE 中的菜单长度不等。
有人知道发生了什么事吗?
I have a CSS menu setup here:
The problem is, I noticed IE doesn't display the menus properly, and now I'm back to using my computer to fix it which has IE8. I'm using compatibility mode.
I've noticed two problems. On the submenu, (Say "Resource Center"), there is extra spacing between each item that when your cursor passes through it closes the menu. This sounds like the IE Whitespace bug but I used PHP to strip out the White-space. If I use float:left;clear:left; it causes the menus to be in-equal lengths in Firefox and IE.
Anybody know what's going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我只在 IE 7 上测试了我的解决方案。
在元素中:
你必须更改
为
I tested my solution only on IE 7.
in elements:
you have to change
to
哇,这花了我一点时间。您确实应该减少在这些元素上使用的 css 数量。您正在覆盖大量级联值等。但是,IE7 有两个主要值存在问题。
第一个是
#main-nav > 上的
。由于某种原因,IE7 在min-width
ul> li ul aa
上具有此值使其忽略它是display: block
。这可能与父级被误插为inline-block
有关(参见#2)。其次是
display: inline-block
由.sub-menu
中的li
从li.menu- 继承
。当我删除这些项目时,IE7 开始正常运行。ul.submenu
上方的项目在所有情况下,这都与您所说的“IE 空白错误”无关。计算空白折叠时,
inline-block
元素的处理方式与inline
元素没有什么不同。 这是符合规范的。 IE 没有错误,任何不将inline
和inline-block
元素之间的空格折叠为 1 个空格的浏览器(不使用bikesheding:discard
) 违反了规范。Wow, that took me a bit. You should really reduce the amount of css that you are throwing at these elements. You are overwriting a lot of cascaded values, etc. However, there are 2 primary values that IE7 is having an issue with.
The first is
min-width
on#main-nav > ul > li ul a
. For some reason IE7 having this value on thea
is making it ignore that it isdisplay: block
. It's probably something related to the parent being misinteruputed asinline-block
(see #2).Second is the
display: inline-block
being inherited by theli
s in the.sub-menu
from theli.menu-item
aboveul.submenu
. When I remove these items IE7 starts acting appropriately.In all cases this has nothing to do with, what you call, the "IE Whitespace Bug".
inline-block
elements are treated no different thaninline
elements when the collapes of whitespace is calculated. This is per the spec. IE does not have a bug, any browser that does not collapse whitespace to 1 single whitespace betweeninline
andinline-block
elements (without the use ofbikesheding: discard
) is in violation of the spec.