如何使css3和html5兼容网站的所有浏览器,包括IE7和更高版本 [英] how to make css3 and html5 compatible website for all browsers including IE7 and later

查看:77
本文介绍了如何使css3和html5兼容网站的所有浏览器,包括IE7和更高版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有任何单一的框架使用我可以建立css3,html5网站是兼容所有浏览器,包括IE7和更高版本? http://html5boilerplate.com/ 样板将帮助我。

解决方案

您将永远不会获得IE7或IE8渲染引擎,以实现与HTML5,CSS3和其他现代技术的完全兼容性。



但是有一些黑客,工具和插件可以让你成为一部分。



Modernizr 之类的工具可以帮助您检测支持哪些功能,从而为您的网站提供机会解决它。



jQuery 是一个伟大的库,但是特别好这个上下文因为它抽象了很多浏览器差异远离开发人员。有些东西在大多数浏览器都很容易,但在IE中的一个真正的痛苦; jQuery采用了很多这样的东西,并使它很容易,不管。



Dean Edwards的IE7.js Selectivzr 都是Javascript库,它们为IE支持许多CSS选择器,在旧版本中丢失。这允许你编写你的样式表,而不用担心什么IE支持。 (IE7.js也修复了一些IE的其他故障和缺少的功能)



CSS3Pie < a>是IE的一个黑客,增加了对CSS border-radius ,渐变和 box-shadow p>

实际上,这些线路上有一大堆黑客,所有这些都旨在为缺少的旧版本的IE添加功能。 Modernizr的网站有一个很大的列表: https://github.com/Modernizr/Modernizr/ wiki / HTML5-Cross-Browser-Polyfills



然而,所有这一切都有一个大的警告。速度。 IE <= 8是一个慢浏览器。它有一个缓慢的Javascript引擎。几乎所有这些黑客都是基于javascript的。你可能会在任何给定的网站上运行其中的一些,但试图使用足够的他们给IE任何东西,像完全支持HTML5和CSS3会减慢浏览器到无法使用的点。



还有另一个角度来处理这个问题,这是Google的Frame的IE插件。这基本上是将整个Google Chrome浏览器引擎安装到IE。用户仍在运行IE shell,但网页的呈现方式与最新版本的Chrome相同。



这听起来不错,但是当然不是完美的。它的主要缺点是最终用户必须将其手动安装到他们的计算机上,这意味着您作为Web开发人员无法控制是否存在。所以它不是你可以只是添加到您的网站,并期望一切神奇工作。



最后,您可能也感兴趣CanIUse.com ,它提供了各种功能的浏览器支持表,让您可以一目了然地看到每个浏览器的各种版本中不支持的是什么。


is there any single framework using i can build css3, html5 website that is compatible for all browsers including IE7 and later ? http://html5boilerplate.com/ boilerplate will help me in this ?

解决方案

You will never get the IE7 or IE8 rendering engine to achieve full compatibility with HTML5, CSS3, and other modern technologies. They are simply not capable of it.

However there are some hacks, tools and plugins which can get you part of the way.

Tools like Modernizr will help you by allowing you to detect which features are supported, to give your site a chance to work around it.

jQuery is a great library anyway, but is particularly good in this context because it abstracts a lot of browser differences away from the developer. Some things are easy in most browsers but a real pain in IE; jQuery takes a lot of that kind of stuff and makes it easy regardless.

Dean Edwards' IE7.js and Selectivzr are both Javascript libraries that give IE support for lots of the CSS selectors which were missing in older versions. This allows you to write your stylesheets without worrying so much about what IE supports. (IE7.js also fixes a number of IE's other glitches and missing features too)

CSS3Pie is a hack for IE that adds support for CSS border-radius, gradients and box-shadow.

There are in fact a whole load of hacks along these lines, all aimed at adding features to older versions of IE which it is missing. Modernizr's website has a big list of them here: https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills

However there is one big caveat to all of this. Speed. IE<=8 is a slow browser. It has a slow Javascript engine. Virtually all of these hacks are javascript based. You might get away with running a few of them on any given site, but trying to use enough of them to give IE anything like full support for HTML5 and CSS3 will slow the browser down to the point of being unusable.

There is one other angle to approach this question though, and that's Google's Frame plugin for IE. This basically installs the entire Google Chrome browser engine into IE. The user is still running the IE shell, but the web page is rendered as it would be in an up-to-date version of Chrome.

This sounds great, but of course it isn't perfect. The main down-side of it is that the end user has to install it manually onto their computer, which means that you as a web developer have no real control over whether it's there or not. So its not something you can just add to your site and expect everything to magically work.

Finally, you may also be interested in CanIUse.com, which gives browser support tables for various features, allowing you to see at a glance what is and what isn't supported in various versions of each browser.

这篇关于如何使css3和html5兼容网站的所有浏览器,包括IE7和更高版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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