跨浏览器的兼容性问题 [英] Cross-browser compatibility issues

查看:138
本文介绍了跨浏览器的兼容性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到很多人有跨浏览器的兼容性问题的问题。

I see that many people have problems with cross-browser compatibility issues.

我的问题是,为什么浏览器渲染HTML,CSS和JS不同?

My question is why do browsers render the html, css or js differently?

它是由于DOM?盒模型?

为什么有跨浏览器兼容的问题时,有来自W3C等?

Why are there cross-browser compatibility issues when there are standards from W3C etc?

是否有在各大互联网浏览器显示HTML内容的方式什么区别吗?为什么说IE,火狐(Mozilla的),歌剧可能有不同的显示相同的内容?

我应该牢记构建跨浏览器兼容的网站是什么时候?

推荐答案

我相信有人会回答这个好多了,但这里有一个启动:

I'm sure someone will answer this much better, but here's a start:

是的,但是也有一些应该相对于CSS渲染遵守的标准。现在的问题是,一些浏览器编辑器(咳嗽的微软的咳嗽的)不认为这是一个优先事项要正确实现规范(甚至是全部,对于这个问题)。甚至,当排版引擎正在开发中,试图以确保兼容性,它可以得到相当讨厌搞清楚如何混合不同的CSS属性和单位时,事情应该正确渲染(参见例如,ACID测试的 http://en.wikipedia.org/wiki/Acid3

Yes, there are standards that are supposed to be adhered with respect to CSS rendering. The problem is, some browser editors (cough Microsoft cough) don't consider it a priority to implement the specifications correctly (or even fully, for that matter). Even, when the layout engine is being worked on to attempt to ensure compatibility, it can get quite nasty figuring out how things should be rendered correctly when mixing various CSS properties and units (see for example, the ACID test http://en.wikipedia.org/wiki/Acid3)

要拥有一个跨浏览器的网站,你基本上要检查所有的网站的网页渲染的正确访问者使用的浏览器(或您的支持)。各种工具,如硒(seleniumhq.org)可以帮助这一点。

To have a cross-browser website, you'll basically have to check all of your website's pages render correctly in the browsers your visitors use (or that you support). Various tools such as Selenium (seleniumhq.org) can help with this.

您基本上要决定你打算做什么

You basically have to decide what you're going to do


  • 设计最小公分母(如果它是IE6,没有太多的你就可以做到)

  • 验证使用CSS和使用黑客(例如clearfix)纠正在某些浏览器错误的行为设计

  • 决定不支持某些浏览器(IE6是一个总理候选人)

  • 嗅探浏览器,并相应地调整显示器(不是preferred办法做到这一点)

对于在操纵DOM的差异,库如jQuery的有很大的帮助,因为他们隐藏实现差异是你。

With respect to differences in manipulating the DOM, libraries such as jQuery help a lot as they hide the implementation differences from you.

作为参考,这是测试您的网站的一个好主意,至少有以下内容:

For reference, it's a good idea to test your website in at least the following:


  • 基于WebKit的浏览器(Chrome,Safari浏览器)

  • 基于Gecko的浏览器(Firefox)

  • IE

  • 歌剧

这篇关于跨浏览器的兼容性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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