[英]Layout issue with ie7
It looks like my website does not look good in ie7 (see screenshot below) My menu supposed to be horizontal is vertical, and facebook & twitter buttons are above each other and not next to each other. 看来我的网站在ie7中看起来不太好(请参见下面的屏幕截图),我的菜单应该是水平的,是垂直的,facebook和twitter按钮位于彼此之上,而不是彼此相邻。 Is there a way to fix these 2 issues? 有没有办法解决这两个问题? Many thanks, 非常感谢,
"My menu supposed to be horizontal is vertical" “我应该是水平的菜单是垂直的”
This type of IE7 problem would typically occur if you were trying to make a set of <li>
or <div>
tags take display:inline-block
-- which works in IE8 and current versions of the other browsers. 如果您试图使一组<li>
或<div>
标记采用display:inline-block
,则通常会出现这种IE7问题,它可以在IE8和其他浏览器的当前版本中使用。
The problem is, IE7 respects display:inline-block
, but only on elements that are, by default, inline such as <span>
or <a>
. 问题是,IE7尊重display:inline-block
,但仅在默认情况下为内联的元素上,例如<span>
或<a>
。 So it just keeps them as blocks, and so they stack vertically. 因此,它只是将它们保留为块,因此它们垂直堆叠。
I would try applying float: left;
我会尝试应用float: left;
to both #nav > li
and #nav a
. 到#nav > li
和#nav a
。
That should fix the vertical stack issue with IE7. 这应该可以解决IE7的垂直堆栈问题。
Here you go: 干得好:
http://jsfiddle.net/aKPgt/ http://jsfiddle.net/aKPgt/
In a nutshell, change: 简而言之,更改:
display:inline-block;
to 至
display:inline;
and add: 并添加:
float:right;
Just remember, you need to REVERSE the order of your menu items in your unordered list, since you're floating RIGHT instead of LEFT. 请记住,由于您浮动的是“右”而不是“左”,因此您需要反转无序列表中菜单项的顺序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.