简体   繁体   English

如何获得间距元素的跨浏览器一致性?

[英]How do I get cross-browser consistency for spacing elements?

I wrote a little application that is an image slider with a couple logos on the top.我写了一个小应用程序,它是一个顶部带有几个徽标的图像滑块。 The spacing is very important for this project, and it is inconsistent across browsers.间距对于这个项目非常重要,跨浏览器不一致。 I have no idea how to fix this, and I'm really stressing out.我不知道如何解决这个问题,我真的很紧张。

This is what it should look like: http://i.imgur.com/ycyeH.jpg它应该是这样的: http : //i.imgur.com/ycyeH.jpg

Thank you so much for your help.非常感谢你的帮助。

I have checked your CSS and I can't see any CSS reset statement in it.我已经检查了您的 CSS,但在其中看不到任何 CSS 重置语句。 Different browsers have different defaults when it comes to undeclared margins or paddings etc. You could insert some statements by yourself at the top, such as对于未声明的边距或填充等,不同的浏览器有不同的默认值。您可以在顶部插入一些自己的语句,例如

* {margin: 0px; padding: 0px}

but there might be other problems such as the different way overflow is managed etc.但可能还有其他问题,例如管理溢出的不同方式等。

So maybe the best option is to include a CSS reset from a library, such as所以也许最好的选择是从库中包含一个 CSS 重置,例如

However, next time try to use jsfiddle as suggested in the other answer, or just learn how to include code here in the post, so we don't need to download archives to view your code.但是,下次尝试按照其他答案中的建议使用 jsfiddle,或者只是学习如何在帖子中包含代码,这样我们就不需要下载档案来查看您的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM