main 标签
来源:互联网 发布:2016中国软件城市排名 编辑:程序博客网 时间:2024/04/27 17:13
HTML5 has added the new structural element <main> added to its specification last year. The purpose of this element is to indicate the important or primary portion of the document where main content is displayed. This <main> element will be added inside the <body> tag. Note that, befor <main> tag, body tag is used for denoting the content portion in the document. With this addition, body tag becomes the general content for the entire document and main tag represents the key part of the content. As the W3C specification clearly states that:
The main content of the body of a document or application. The main content area consists of content that is directly related to or expands upon the central topic of a document or central functionality of an application. ( W3C )
Where as, the definition of body tag takes the generic meaning of the content.
The body element represents the content of the document. ( W3C )
Some of the key points about using the <main> tag is:
- You can use only once in the document.
- If you use multiple times in a document, HTML validator would throw an error.
- Also, the main element can not be used for decedent of an
<article>
,<aside>
,<footer>
,<header>
, or<nav>
elements. The reason behind this is that it is not an section element. - The challenging part on implementing the main element is that not all the browsers support this element. The easiest way to use this element is to add role as “main” for the existing div tags.
- Note that this tag is primarily helpful to the screen readers to read the main part of the content.
<body> <header role="website"> </header> <div id="content" class="primary" role="main"> </div> <footer role="footerinfo"> </footer></body>
If the browsers are supporting these element nowadays, then this same above markup could be like this:
<body> <header role="website"> </header> <main id="content" class="primary" role="main"> </main> <footer role="footerinfo"> </footer></body>
Since this is only structural element, there is not need for displaying the example. Still there are lot of controversies around using this element. We have to wait and watch the future role of this element in the HTML5 world.
- main 标签
- android的main.xml和标签
- HTML 5中又新增加main标签
- main
- main()
- Main
- main
- main()
- Main
- main
- main
- Main
- main
- main()
- main()
- main
- Main
- main
- Highcharts标题Title(二)
- 前端常见BUG--js,及处理方法(持续更新)
- SQL to Mongo Shell to C++ ( 备忘 )
- 句子相似度
- 植物大战僵尸二:游戏界面的绘制
- main 标签
- 微信和百度地图都不支持iOS6了
- Spring中的DI(依赖注入)--给对象的属性赋值
- Android 代码实现logcat输出到文件
- 【.Net码农】 jquery访问ashx文件示例
- Unity技巧2
- DWZ实现排序
- 一场大雨引发的思考
- [网易笔试]Best Compression Algorithms