IE 中的顶部边距问题
我在 IE 中遇到边距问题。 我在 div 中放置了一张图像。我把所有边距设置为0。 但顶部利润仍然显示出一点。我不想将
margin-top 设置为负值。这种情况只发生在 Ie 中,因为在 firefox 中 它的位置完美。
您有解决方法吗? 这是我对 div 的属性:
.placeImage {
visibility:visible;
overflow:auto;
height:400px;
background-image: url(image.jpg);
background-repeat: no-repeat ;
background-position:left;
}
我读到我可以将 margin:0 放在 body 标记中,这样:
<body style="margin-top:0; margin-left:0;">
左边距还可以,但顶部仍然在后面显示一点空间。 帮助..
I have a problem with the margin in IE.
I have an image placed in div. I made all the margins set to 0.
But still the top margin is showing a little. I don't want to set the
margin-top to a negative value. This happens only in Ie because in firefox
its positioned perfectly.
Do you have workaround for this?
Here's my attritbutes to div:
.placeImage {
visibility:visible;
overflow:auto;
height:400px;
background-image: url(image.jpg);
background-repeat: no-repeat ;
background-position:left;
}
I read that I can put margin:0 in the body tag so:
<body style="margin-top:0; margin-left:0;">
The left margin is okay but the top still shows a little space at the back..
Help..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试输入:
编辑
请随意查看这里的 jsFiddle 演示:
http:// jsfiddle.net/Lrume/2/
Try putting:
EDIT
Feel free to look at this jsFiddle here demonstrating this:
http://jsfiddle.net/Lrume/2/
解决这个填充问题固然很好,但默认样式表中还有许多其他跨浏览器的小怪癖,可能会让您陷入困境。
您真正需要做的是使用“重置”样式表一次性消除所有这些怪癖。
这是一个很常见的问题,很多人都编写了重置样式表。我使用 HTML5 Boilerplate,但这不仅仅是重置样式表,所以我不推荐特定的样式表,而是将向您指出 Stackoverflow 上其他地方的讨论,其中涵盖了大部分选项:https://stackoverflow.com/questions/116754/best-css-reset
希望有帮助
Fixing this padding issue is all well and good, but there are a number of other little cross-browser quirks in the default stylesheets which may trip you up.
What you really need to do is use a 'reset' stylesheet to iron out all those quirks in one go.
This is quite a common issue, and a number of people have written reset stylesheets. I use HTML5 Boilerplate, but this does a lot more than just resetting stylesheets, so rather than recommend a specific one, I'll point you to this discussion elsewhere on Stackoverflow that covers most of the options: https://stackoverflow.com/questions/116754/best-css-reset
Hope that helps