简体   繁体   English

浮点在IE 7和IE 8中看起来有所不同(经HTML验证)

[英]Float looks different in IE 7 and IE 8 (html validated)

Hello I am trying to understand differences in the rendering of this page in Chrome (the target) and IE 7/8: 您好,我试图了解此页面在Chrome(目标)和IE 7/8中的呈现差异:

http://phor.net/PRIV/md2/ (it validates)

In IE 7, the top navbar does not float the LIs and in IE 8, there's a hideous margin at the top. 在IE 7中,顶部导航栏不会浮动LI,而在IE 8中,顶部则有一个空白。

This page is very simple, with all style in 此页面非常简单,所有样式都在

http://phor.net/PRIV/md2/style.css

Any idea on how to fix that navbar? 关于如何修复该导航栏的任何想法? Thank for your help and discussion. 感谢您的帮助和讨论。

IE7 does not fully support the inline-block property that you are using on your navigation bar. IE7不完全支持您在导航栏上使用的inline-block属性。

http://www.quirksmode.org/css/display.html http://www.quirksmode.org/css/display.html

Try using floats instead. 尝试改用浮点数。

#navbar ul li { float: left; } 

Make sure you clear your floats afterward. 确保之后清除浮标。

IE7 doesn't support inline-table , you could use float: left; IE7不支持inline-table ,您可以使用float: left; or display: inline; display: inline; .

Sorry, don't see any huge margin in IE8. 抱歉,在IE8中看不到任何丰厚利润。

use float:left property instead of display:inline-table 使用float:left属性代替display:inline-table

Change this 改变这个

#navbar li {
font: 14px Arial;
margin: 0;
margin-right: -2em;
list-style-type: none;
display: inline-table;
}

to

#navbar li {
font: 14px Arial;
margin: 0;
list-style-type: none;
float:left;
Padding:0px 10px 0px 10px;}

try 尝试

#navbar li { display:block; float:left; width:160px;}
#navbar ul { overflow:hidden;}

and remove all display:inline-table 并删除所有display:inline-table

I make an example for you 我为你举例

Example

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

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