本文介绍了html5语义元素和旧浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我即将为网页设计一个新的布局,并希望利用这一时刻实现一些html5标记。

I am about to design a new layout for a webpage and wanted to take advantage of this moment to implement some html5 markup.

我的第一件事就是mind是语义元素(nav,header,article ..)

The first thing that comes in my mind are the semantic elements (nav, header, article..)

检查我注意到IE8(及以下版本)不支持这些元素。
这可能意味着我无法设置期望连贯结果的语义元素。

After checking http://caniuse.com/#feat=html5semantic I noticed that IE8 (and below) don't support the elements.This probably means that I cannot style the semantic elements expecting a coherent result.

网站收到来自IE7 / 8浏览器的大量流量而且我不喜欢我不知道如何继续。
我听说过modernizr和html5shiv,但我不知道现在最好的标准是什么..

The website receives quite a lot of traffic from IE7/8 browsers and I don't know how to proceed.I heard about modernizr and html5shiv but I don't know what's the best standard nowadays..

推荐答案

因为你'只寻找一种方法来设置HTML5元素的样式,使用HTML5Shiv(专门为此目的而设计)。 Modernizr包含更多功能。您不打算使用(根据问题判断)。

Because you're only looking for a method to style HTML5 elements, use HTML5Shiv (which is specifically designed for this purpose). Modernizr contains many more features. which you're not going to use (judging by the question).

这是源代码,如果您想知道:

Here's the source code, in case you're wondering: https://github.com/aFarkas/html5shiv/blob/master/src/html5shiv.js

这篇关于html5语义元素和旧浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 07:30