< div>元素在IE,不是在FF或Opera [英] Strange gap between <div> elements in IE, not in FF or Opera

查看:86
本文介绍了< div>元素在IE,不是在FF或Opera的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



使用FF,Opera和IE浏览器这是在Windows 7(不记得它是什么),页面看起来完全一样它应该,但在Windows Vista上使用IE7,导航栏和其余的页面之间有一个差距坦率地使它看起来愚蠢



我有一个重置样式表来重置所有的元素,没有填充,边距等,FF,Opera和IE上Windows 7产生的页面,因为他们应该,它只有IE7(我猜猜IE的早期版本)不。



这里有2个截图显示问题,第一个来自Windows 7上的FF / Opera / IE:





这是来自Windows Vista上的IE7:





这里是一个链接到实际有问题的网站: Figaro的Ristorante



任何



感谢您的时间。

解决方案

ve遇到这个问题bazillion次。将它添加到您的CSS:

  #header img {vertical-align:bottom} 

在IE中有一个有趣的错误,包括版本7,它将一些空格(一个空文本节点,真的)作为真正的文本节点



另一种选择是将图像声明为块级元素:

  #header img {display:block} 


b $ b

这个CSS可以安全地添加到你的全局文件,它不会干扰其他浏览器如何渲染页面。


I know this kind of question must get asked all the time but I haven't found a solution for my problem yet.

Using FF, Opera and the IE that is on Windows 7 (can't remember what it is), the page looks exactly as it should, but using IE7 on Windows Vista, there is a gap between my navigation bar and the rest of the page which frankly makes it look stupid, and the illusion of tabbed pages is lost.

I have a reset stylesheet to reset all the elements to have no padding, margins etc and FF, Opera and the IE on Windows 7 produce the page as they should, it's only IE7 (and I'm guessing earlier versions of IE) that don't.

Here are 2 screenshots showing the problem, the first from FF/Opera/IE on Windows 7:

This one is from IE7 on Windows Vista:

And here is a link to the actual website in question: Figaro's Ristorante

Any ideas anyone?

Thanks for your time.

解决方案

I've run into this problem a bazillion times. Add this to your CSS:

#header img { vertical-align: bottom }

There's a funny bug in IE up to and including version 7 where it will treat some whitespace (an empty text node, really) as a real text node, and align the image as if there was text in the element as well.

Another option would be to declare the image as a block level element:

   #header img { display: block }

This CSS is safe to add to your global file, it will not interfere with how other browsers render the page.

这篇关于< div>元素在IE,不是在FF或Opera的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆