Skip to content

HTML6 展望

html6

HTML5 概述

HTML5 是 HTML 语言最受欢迎的版本之一,它支持音频和视频、离线存储、移动端、和标签属性等等。还提供了

,
,
这样的标签来帮助开发者更好地组织页面内容。然而 HTML5 规范仍然没有最后定稿,并且它并不是一个真正意义上的语义标记语言。

HTML6 展望

你有没有曾经希望能在 HTML 中使用自定义标签?比如:使用来显示你的网站logo,还有使用来显示工具栏等等。我们经常使用

来组织页面,在 HTML6 里我们希望可以直接使用象这样的自定义标签。

和 XML 一样,HTML6 应该支持 namespace(命名空间),如:xmlns:xhtml=”http://www.w3.org/1999/xhtml”

HTML6 代码样例:

<!DOCTYPE html>
 <html:html>
 <html:head>
 <html:title>A Look Into HTML6</html:title>
 <html:meta type="title" value="Page Title">
 <html:meta type="description" value="HTML example with namespaces">
 <html:link src="css/mainfile.css" title="Styles" type="text/css">
 <html:link src="js/mainfile.js" title="Script" type="text/javascript">
 </html:head>
 <html:body>
 <header>
 <logo>
 <html:media type="image" src="images/xyz.png">
 </logo>
 <nav>
 <html:a href="/img1">a1</a>
 <html:a href="/img2">a2</a>
 </nav>
 </header>
 <content>
 <article>
 <h1>Heading of main article</h1>
 <h2>Sub-heading of main article</h2>
 <p>[...]</p>
 <p>[...]</p>
 </article>
 <article>
 <h1>The concept of HTML6</h1>
 <h2>Understanding the basics</h2>
 <p>[...]</p>
 </article>
 </content>
 <footer>
 <copyright>This site is © to Anonymous 2014</copyright>
 </footer>
 </html:body>
 </html:html>

在上面的代码中,你也许注意到了一些奇怪的标签,它们是 W3C 和 HTML6 规范中在命名空间里定义的标签。例如:负责设定你浏览器的标题栏文字,负责显示图片等等。用户可以自己定义标签以便 JavaScript 和 CSS 识别和处理,这样页面代码会更易读,语义更清晰。

HTML6 APIs

HTML6 的标签前带有命名空间,如:, 等等。

<!DOCTYPE html>
 <html:html>// this is equivalent to <html> tag written in previous HTML versions
 <!-- sample of HTML document -->
 </html:html>
  1. 和 标签一样。
<!DOCTYPE html>
 <html:html>
 <html:head>
 <!-- Main content would come here, like the <html:title> tag -->
 </html:head>
 </html:html>
  1. 标签类似。</li> </ol> <div class="highlight"><pre><span></span><code><!DOCTYPE html> <html:html> <html:head> <html:title>A Look Into HTML6</html:title> </html:head> </html:html> </code></pre></div> <ol> <li><html:meta> 和 <meta> 标签类似,不同之处在于,在 HTML5 中你只能使用标准的元数据类型,如:”keywords”, “description”, “author”等,而在 HTML6 中你可以使用任何元数据类型。</li> </ol> <div class="highlight"><pre><span></span><code><!DOCTYPE html> <html:html> <html:head> <html:title>A Look Into HTML6</html:title> <html:meta type="description" value="HTML example with namespaces"> </html:head> </html:html> </code></pre></div> <ol> <li><html:link> 和 HTML6 之前版本的 <link> 标签类似。</li> </ol> <div class="highlight"><pre><span></span><code><!DOCTYPE html> <html:html> <html:head> <html:title>A Look Into HTML6</html:title> <html:link src="js/mainfile.js" title="Script" type="text/javascript"> </html:head> </html:html> </code></pre></div> <ol> <li><html:body> 和 <body> 标签一样。</li> </ol> <div class="highlight"><pre><span></span><code><!DOCTYPE html> <html:html> <html:head> <html:title>A Look Into HTML6</html:title> </html:head> <html:body> <!-- This is where your website content is placed --> </html:body> </html:html> </code></pre></div> <ol> <li><html:a> 和 <a> 标签类似,区别是 <html:a> 只有 “href” 一个属性。</li> </ol> <div class="highlight"><pre><span></span><code><!DOCTYPE html> <html:html> <html:head> <html:title>A Look Into HTML6</html:title> </html:head> <html:body> <html:a href="http://siteurl">Go to siteurl.com!</html:a> </html:body> </html:html> </code></pre></div> <ol> <li><html:button> 和 <button> 及 <input type=”button”> 一样。</li> </ol> <div class="highlight"><pre><span></span><code><!DOCTYPE html> <html:html> <html:head> <html:title>A Look Into HTML6</html:title> </html:head> <html:body> <html:button>Click Here</html:button> </html:body> </html:html> </code></pre></div> <ol> <li><html:media> 涵盖 <img>, <video>, <embed> 等标签的所有功能。<html:media> 的好处是你不用根据不同的媒体文件类型使用不同的标签,媒体的类型由浏览器从文件内容(类型属性,扩展名,和MIME type)中来判断。</li> </ol> <div class="highlight"><pre><span></span><code><!DOCTYPE html> <html:html> <html:head> <html:title>A Look Into HTML6</html:title> </html:head> <html:body> <!-- Image would come here --> <html:media src="img1/logo.jpg" type="image"> <!-- Video doesn't need a type --> <html:media src="videos/slide.mov"> </html:body> </html:html> </code></pre></div> <h3 id="tag-types">标签类型(Tag types)概述<a class="headerlink" href="#tag-types" title="Permanent link">¶</a></h3> <p>和 HTML5 一样, HTML6 也有两种标签类型:单标签(single tag) 和双标签(double tag)</p> <div class="highlight"><pre><span></span><code><html:meta type="author" content="single tag"> <html:meta type="author" content="double tag" /> </code></pre></div> <p>单标签不需要结束符’/’</p> <h3 id="_1">结语<a class="headerlink" href="#_1" title="Permanent link">¶</a></h3> <p>HTML6 规范还未发布,本文原作者 <a href="http://html6spec.com/">Oscar Godson</a> 只是为我们提供了一个对 HTML6 规范的展望,或者说他希望 HTML6 能够支持的一些新特性。</p> <p>原文链接:<a href="http://java.dzone.com/articles/look-html6-what-it-and-what">A Look Into HTML6 – What Is It, and What Does it Have to Offer?</a></p> <p><strong>(转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 – CoolShell</a> ,请勿用于任何商业用途)</strong></p> <h3 id="_2">相关文章<a class="headerlink" href="#_2" title="Permanent link">¶</a></h3> <ul> <li><a href="https://coolshell.cn/articles/9666.html"><img alt="浏览器的渲染原理简介" src="../../wp-content/uploads/2013/05/Render-Process-150x150.jpg" /></a><a href="https://coolshell.cn/articles/9666.html">浏览器的渲染原理简介</a></li> <li><a href="https://coolshell.cn/articles/6840.html"><img alt="CSS 布局:40个教程、技巧、例子和最佳实践" src="../../wp-content/uploads/2012/03/css-layouts-150x150.gif" /></a><a href="https://coolshell.cn/articles/6840.html">CSS 布局:40个教程、技巧、例子和最佳实践</a></li> <li><a href="https://coolshell.cn/articles/5537.html"><img alt="一些文章资源和趣闻" src="../../wp-content/uploads/2011/11/stackparts.com_-150x150.png" /></a><a href="https://coolshell.cn/articles/5537.html">一些文章资源和趣闻</a></li> <li><a href="https://coolshell.cn/articles/5224.html"><img alt="一些文章和各种资源" src="../../wp-content/uploads/2011/09/image008-150x150.jpg" /></a><a href="https://coolshell.cn/articles/5224.html">一些文章和各种资源</a></li> <li><a href="https://coolshell.cn/articles/4795.html">https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/7.jpg</a><a href="https://coolshell.cn/articles/4795.html">开源中最好的Web开发的资源</a></li> <li><a href="https://coolshell.cn/articles/3903.html">https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/14.jpg</a><a href="https://coolshell.cn/articles/3903.html">一些有意思的贴子和工具</a> The post <a href="https://coolshell.cn/articles/12206.html">HTML6 展望</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.</li> </ul> </article> </div> </div> </main> <footer class="md-footer"> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class="md-copyright"> Made with <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener"> Material for MkDocs </a> </div> </div> </div> </footer> </div> <div class="md-dialog" data-md-component="dialog"> <div class="md-dialog__inner md-typeset"></div> </div> <script id="__config" type="application/json">{"base": "../..", "features": [], "search": "../../assets/javascripts/workers/search.208ed371.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script> <script src="../../assets/javascripts/bundle.b4d07000.min.js"></script> </body> </html>