ie7 中的导航菜单 css 样式子菜单间隙
我有一个由 WordPress 生成的导航菜单,这意味着我几乎无法控制它的输出方式。
我已经使用 CSS 按照我想要的方式设置悬停子菜单的样式,但它在 IE7 中看起来不太好。在其他浏览器中没有任何问题。
即使在正常工作的浏览器中,主菜单也可能看起来关闭,因为我在网站上使用 @fontface
但未包含在 jsFiddle 中。主要问题是子菜单项之间的间隙。
我尝试垂直对齐子菜单 li
和 a
,但它要么使情况变得更糟,要么没有解决问题。
我在这里复制了这个问题:[链接已删除]
如果我添加
#menu-header .sub-menu a { height: 100%; }
它可以修复垂直间隙问题,但项目不再具有相同的宽度。
I have a navigation menu generated by Wordpress, meaning I have pretty much no control on how it is output.
I have used css to style it the way I want with on-hover submenus, but it looks off in IE7. It does not have any problems in other browsers.
The main menu may seem off even in browsers that work because I am using @fontface
on my website but did not include in the jsFiddle. The main problem is the gaps between the submenu items.
I have tried vertically aligning the submenu li
and a
, but it either made it worse or didn't fix the problem.
I have replicated the problem here: [link removed]
If I add
#menu-header .sub-menu a { height: 100%; }
It fixes the vertical gap problem, but the items are no longer the same width.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试以下操作:
这将消除间隙,但项目的宽度将与内部内容相同。
前段时间我也遇到了同样的问题。我所做的是,在
li
内创建一个容器div
。以便较长的文本可以换行,并设置静态宽度。您甚至可以使用 jQuery 动态调整每个下拉列表的宽度,但这是一个完全不同的故事。很少参考:
http://work.arounds.org/issue/20/removing-gaps- Between-list-items-containing-anchor/
http://www.456bereastreet.com/archive/200610/looking_the_gap_ Between_list_items_in_ie/
http:// www.belafontecode.com/3-ways-to-get-rid-of-spaces-in-list-item-navigation-in-ie6/
You can try the following :
This will remove the gap, but items will be the same width as the inner content.
I had the same problem some time ago. What I did was, create a container
div
inside theli
. so that longer text can wrap, and set a static width. You can even use jQuery to adjust the widths of each dropdown dynamically, but that a whole different story.Few references :
http://work.arounds.org/issue/20/removing-gaps-between-list-items-containing-anchor/
http://www.456bereastreet.com/archive/200610/closing_the_gap_between_list_items_in_ie/
http://www.belafontecode.com/3-ways-to-get-rid-of-spaces-in-list-item-navigation-in-ie6/