IE7边框问题
我的网页中有一个宽度为 0 的 div,其左右边框各为 1px 宽度。
在 Firefox 中,当我给出以下代码时,它保存宽度为 50px 的 div,但在 IE7 中它恰好是 48px 宽。
<div style="width: 48px; border: #a9a9a9 1px solid; height: 30px;">test div</div>
谁能帮我解决这个问题?
提前致谢。
Im my web page there is a div with width 0 which has a left and right border of 1px width each.
In Firefox when I give the following code it holds the div with 50px width, but it happens to be 48px wide in IE7.
<div style="width: 48px; border: #a9a9a9 1px solid; height: 30px;">test div</div>
Can anyone help me resolving this issue?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来像 IE 框模型错误。 如果在 Quirks 模式下,IE 会从元素宽度中减去边框、填充、边距。 请参见下图:
如果您为 HTML 声明了正确的 DOCTYPE,则此问题应该会消失。
Looks like IE box model bug. If in Quirks mode, IE subtracts border, padding, marginfrom element width. See the diagram below:
If you declare correct DOCTYPE for your HTML, this problem should go away.