IE9 exibits 4px偏移量比IE8 [英] IE9 exibits 4px offset compared to IE8

查看:171
本文介绍了IE9 exibits 4px偏移量比IE8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这恰好是顶部填充加上元素id f3c上的底部填充。我附上了两张图片 - IE8和IE9之一。

This happens to be the top padding plus the bottom padding on the element id f3c. I have attached two pics - one of IE8 and one of IE9.

我试图从调试器捕获相关信息。基本上我有一个链接里面的字段集,内部的形式。字段集是这样的页面验证。

I tried to capture the relevant information from the debugger. Basically I have a link inside a fieldset, inside a form. The fieldset is so the page validates.

我使用相对定位的链接(顶部:9px)。

I'm using relative positioning for the link (top:9px).

不确定为什么IE9会在IE8的计算中添加4px,除非因为某种原因它计数(padding-top:2px和padding-bottom:2px)。

Not sure why IE9 would add in in 4px from IE8's calculation unless for some reason it is counting the (padding-top:2px and padding-bottom:2px).

实际DOCTYPE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


推荐答案

根据屏幕截图,您在内联元素中添加了填充。

Based on the screenshot, you're adding padding to an inline element.

尝试添加:

display: inline-block;

并进行调整。

edit:

内联元素不应用margin / padding / width / height(以及它们不应该像浏览器一样具有非标准行为)

Inline elements don't apply margin/padding/width/height (well they shouldn't but browsers like ie have non-standard behaviours)

块元素可以有margin / padding / width / height,但它们会导致元素垂直堆叠。

Block elements can have margin/padding/width/height but they cause elements to be stacked vertically.

inline-block是他们之间的一种混合。它们允许其他内联元素垂直放置在它们旁边,但您也可以为它们添加margin / padding / width / height。

inline-block is kind of a hybrid between them. They allow other inline elements to be placed vertically next to them, however you can also add margin/padding/width/height to them.

我的一般规则是块级别元素是页面(框架)中的重构建元素,其中内联是页面内的内容(粗体,斜体等)。 inline-block允许你用边距,填充来略微压缩内联元素。

My general rule is that block level elements are the heavy construction elements in a page (the framework) where as inline is for the content within the page (bold, italics, etc). inline-block allows you to fudge inline elements a little with the margin, padding.

注意:请注意,在旧版本的ie中,这仍然不是像素完美。

note: Just be aware that in older versions of ie this still isn't pixel perfect.

这篇关于IE9 exibits 4px偏移量比IE8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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