我可以使用哪些HTML5的标签,而无需担心浏览器的兼容性? [英] Which HTML5 tags can I use without worrying about browser compatibility?

查看:138
本文介绍了我可以使用哪些HTML5的标签,而无需担心浏览器的兼容性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立在PC上使用Web应用程序。什么是HTML5标签走就走从到prevent兼容性问题IE8一样的浏览器及以上?

I am building a web app for use on PCs. What are the HTML5 tags to stay away from to prevent compatibility issues with Browsers like IE8 and above?

请注意:大多数问题都是1-3岁就这个问题

Note: Most questions are 1-3 years old on this subject.

推荐答案

您询问从什么呆HTML5标签了。

You asked what HTML5 tags to stay away from.

好一些来自HTML5从我的知识标签是为语义原因的。例如像以下。

Well Some of the tags from HTML5 from my knowledge were made for semantic reasons. like the following for example.

<article> <section> <aside> <nav> <header> <footer> ..ect

这几乎是与精细的工作,只是需要一点CSS如的。 显示:块; 在大多数浏览器正常工作,但在旧的浏览器IE浏览器。 Internet Explorer中您需要以JavaScript创建一个元素为它是兼容的。

These are almost fine to work with, and just require a bit of CSS eg. display: block; to work normally in most browsers, though in older browsers ie. Internet Explorer you are required to create a element in Javascript in order for it to be compatible.

下面是一个例子。

document.createElement('article');

将设置&lt;物品方式&gt; 元素以供使用老年人的Internet Explorer

Would set the <article> element up for use in older Internet Explorer.

对于需要JavaScript功能工作更先进的HTML5标记都是一些像下面这样。

For more advanced HTML5 tags that require Javascript functionality to work are some like the following.

<audio> <video> <source> <track> <embed> And most importantly <canvas> 

这些元素都难以支持旧的浏览器/下脚。虽然我已经包括了一个链接,在底部的跨浏览器polyfills,虽然我没有亲自调查他们。

These elements are harder to support/shiv in older browsers. Although I have included a link to cross browser polyfills at the bottom, although I haven't personally investigated them.

所以,我要说的是,这并不需要Javascript功能的任何元素是完全没有用的跨浏览器支持code的一点​​点使用。

So I would say that any element that doesn't require Javascript functionality are perfectly fine to use with a tiny bit of cross browser support code.

如果您的定位的> IE8 ,然后如果你用毒刃,你应该罚款。

If your targeting >IE8 then you should be fine if you use a shiv.

我怎么叫老的浏览器? &LT; IE9

What do I call older browsers? < IE9

对于HTML5的标签浏览器支持今天。

Browser support for HTML5 tags today is.

<section>, <article>, <aside>, <header>, <footer>, 
<nav>, <figure>, <figcaption>, <time>, <mark>

不被Internet Explorer支持小于 8 ,但可以固定这个样子。

Are not supported by Internet Explorer less than 8 but can be fixed like this.

CSS:

section, article, aside, header, footer, nav, figure, figcaption{
   display: block;
}
time, mark { 
    display: inline-block;
}

的Javascript:

var elements = ['section', 'article', 'aside', 'header', 'footer', 'nav', 'figure', 'figcaption', 'time', 'mark'];
for( var i = 0; i < elements.length; i++ ) {
    document.createElement(elements[i]);
}

&LT;音频&GT; &lt;视频&GT; &LT;&帆布GT; 未在&LT的支持; IE 9

&LT;&嵌入GT; 元素有部分支持的> IE8

您也应该考虑这个标签。

 <meta http-equiv="X-UA-Compatible" content="IE=edge">

标记告诉Internet Explorer显示在IE最高模式中可用的页面,而不是进入兼容模式和渲染网页作为IE7或8会怎么做。在该更多信息<一个href=\"http://stackoverflow.com/questions/6771258/whats-the-difference-if-meta-http-equiv-x-ua-compatible-content-ie-edge\">Here.

This meta tag tells Internet Explorer to display the page in highest IE mode available, instead of going into compatibility mode and rendering the page as IE7 or 8 would do. More info on that Here.

对于脚启动,你可以检查出的 HTML5样板

For a Kick Start you can check out HTML5 BoilerPlate

有关浏览器的兼容性支持表,你可以检查出 - http://caniuse.com/

For browser compatibility support tables you can check out - http://caniuse.com/

HTML5希夫 - https://github.com/afarkas/html5shiv

HTML5 Shiv - https://github.com/afarkas/html5shiv

HTML5 Polyfills的清单 - <一个href=\"https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills\">https://github.com/Modernizr/Modernizr/wiki/...

List of HTML5 Polyfills - https://github.com/Modernizr/Modernizr/wiki/...

更新

由于在评论中提到

小心的元标记X-UA兼容。如果你使用类似的东西具有包围元素(这也恰好与HTML5的doctype IIRC)条件注释HTML5的样板,你可能会遇到与IE9迫使自己变成IE7标准模式,即使有标签的问题。 IE罢工再次

Be careful with the meta tag X-UA-Compatible. If you use something like html5 boilerplate that has conditional comments surrounding the element (this also happens with the html5 doctype IIRC), you may run into problems with IE9 forcing itself into IE7 standards mode even with the tag. IE strikes again

您可能想看看这个,我什么都没有的时刻来支持这一行动。

You may want to look into this, I have nothing to back this up at the moment.

这篇关于我可以使用哪些HTML5的标签,而无需担心浏览器的兼容性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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