奇怪的 IE7 错误导致输入字段出现布局问题
这是我正在处理的示例页面: http://rivalroo.benlwilliams.com/create.html
如果您在 IE7 或 IE8 兼容模式下查看,您会发现输入字段的第二列和第三列似乎想要继承包含 div 的 100px 左边距。即使将输入字段的左边距指定为 0,它仍然应用了这个神秘的 100px 左边距,但在 IE 的检查器中没有显示。
如果我删除列 div 的左边距,那么它就可以很好地排列,这就是为什么第一列的字段排列正确。
有人能解决这个 IE7 的错误吗?
Here's the sample page I'm working on: http://rivalroo.benlwilliams.com/create.html
If you view in IE7 or IE8 Compatibility mode, you'll see that the second and third column of input fields seem to want to inherit the containing div's left margin of 100px. Even if assign the input field's left-margin to 0, it still has this mysterious left margin of 100px applied to it, but not shown in IE's inspector.
If I remove the left margin of the column div, then it lines up just fine, which is why the first column has the fields arranged properly.
Anybody have a solution to this IE7 bug?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过将表单元素包装在另一个没有属性的 div 中,它应该会破坏 hasLayout“链”。 的形式嵌套一个 div
即以相关帖子
have you tried wrapping the form elements in another div with no properties, it should break the hasLayout "chain". i.e nest a div in the form
related post
我发现这个问题与IE6&7有关has-layout的bug有关。如果表单字段的父元素具有布局,则它会继承其边距。我将边距提供的间距更改为填充,它解决了问题。
但是,如果有人有更好的解决方案可以让开发人员保留边距,那就太棒了,因为在设计中并不总是可以将边距更改为填充。
I found that this issue has to do with a bug of IE6&7 regarding has-layout. If the parent element of a form field has-layout, then it inherits it's margin. I changed the spacing provided by a margin to padding and it resolved the issue.
But if anyone has a better solution that lets a developer keep the margin, that would be awesome, because changing the margin to padding isn't always possible with the design.