RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
HTML5浏览器支持-4.2HTML5

您可以帮助老版本浏览器处理 HTML5。

创新互联建站网站建设公司,提供成都做网站、网站制作、成都外贸网站建设,网页设计,建网站,PHP网站建设等专业做网站服务;可快速的进行网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,是专业的做网站团队,希望更多企业前来合作!

HTML5 浏览器支持

所有现代浏览器都支持 HTML5。

此外,所有浏览器,不论新旧,都会自动把未识别元素当做行内元素来处理。

正因如此,您可以帮助老式浏览器处理”未知的“ HTML 元素。

注释:您甚至可以教授石器时代的 IE6 如何处理未知的 HTML 元素。

把 HTML5 元素定义为块级元素

HTML5 定义了八个新的语义 HTML 元素。所有都是块级元素。

您可以把 CSS display 属性设置为 block,以确保老式浏览器中正确的行为:

实例 header, section, footer, aside, nav, main, article, figure { display: block; }
向 HTML 添加新元素

您可以通过浏览器 trick 向 HTML 添加任何新元素:

本例向 HTML 添加了一个名为  的新元素,并为其定义 display 样式:

实例 Creating an HTML Element

My First Heading

My first paragraph.

My First Hero

已添加的 JavaScript 语句 document.createElement("myHero"),仅适用于 IE。

Internet Explorer 的问题

上述方案可用于所有新的 HTML5 元素,但是:

注意:Internet Explorer 8 以及更早的版本,不允许对未知元素添加样式。

幸运的是,Sjoerd Visscher 创造了 "HTML5 Enabling JavaScript", "the shiv":

以上代码是一段注释,但是 IE9 的早期版本会读取它(并理解它)。

完整的 Shiv 解决方案 实例 Styling HTML5

My First Article

London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.

引用 shiv 代码的链接必须位于 元素中,因为 Internet Explorer 需要在读取之前认识所有新元素。

HTML5 Skeleton 实例 HTML5 Skeleton

HTML5 SKeleton

Famous Cities

London

London is the capital city of England. It is the most populous city in the United Kingdom,with a metropolitan area of over 13 million inhabitants.

Paris

Paris is the capital and most populous city of France.

Tokyo

Tokyo is the capital of Japan, the center of the Greater Tokyo Area,and the most populous metropolitan area in the world.

© 2014 W3Schools. All rights reserved.


网页名称:HTML5浏览器支持-4.2HTML5
网站路径:http://cqwzjz.cn/article/dghhdoe.html