自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

HTML6 初探 — 你沒看錯,是6不是5

開發(fā) 前端
HTML5 是 HTML 語言最受歡迎的版本之一,它支持音頻和視頻、離線存儲、移動端、和標(biāo)簽屬性等等。還提供一些標(biāo)簽來幫助開發(fā)者更好地組織頁面內(nèi)容。然而 HTML5 規(guī)范仍然沒有最后定稿,并且它并不是一個真正意義上的語義標(biāo)記語言。

HTML5 概述

HTML5 是 HTML 語言***的版本之一,它支持音頻和視頻、離線存儲、移動端、和標(biāo)簽屬性等等。還提供了<article>, <section>, <header>這樣的標(biāo)簽來幫助開發(fā)者更好地組織頁面內(nèi)容。然而 HTML5 規(guī)范仍然沒有***定稿,并且它并不是一個真正意義上的語義標(biāo)記語言。

HTML6 展望

\

你有沒有曾經(jīng)希望能在 HTML 中使用自定義標(biāo)簽?比如:使用<logo>來顯示你的網(wǎng)站logo,還有使用<toolbar>來顯示工具欄等等。我們經(jīng)常使用<div id=”container”>和<div id=”wrapper”>來組織頁面,在 HTML6 里我們希望可以直接使用象<container>和<wrapper>這樣的自定義標(biāo)簽。

和 XML 一樣,HTML6 應(yīng)該支持 namespace(命名空間),如:xmlns:xhtml=”http://www.w3.org/1999/xhtml”

HTML6 代碼樣例:

  1. <!DOCTYPE&nbsp;html> 
  2.  
  3. &nbsp;<html:html> 
  4.  
  5. &nbsp;<html:head> 
  6.  
  7. &nbsp;<html:title>A&nbsp;Look&nbsp;Into&nbsp;HTML6</html:title> 
  8.  
  9. &nbsp;<html:meta&nbsp;type="title"&nbsp;value="Page&nbsp;Title"> 
  10.  
  11. &nbsp;<html:meta&nbsp;type="description"&nbsp;value="HTML&nbsp;example&nbsp;with&nbsp;namespaces"> 
  12.  
  13. &nbsp;<html:link&nbsp;src="css/mainfile.css"&nbsp;title="Styles"&nbsp;type="text/css"> 
  14.  
  15. &nbsp;<html:link&nbsp;src="js/mainfile.js"&nbsp;title="Script"&nbsp;type="text/javascript"> 
  16.  
  17. &nbsp;</html:head> 
  18.  
  19. &nbsp;<html:body> 
  20.  
  21. &nbsp;<header> 
  22.  
  23. &nbsp;<logo> 
  24.  
  25. &nbsp;<html:media&nbsp;type="image"&nbsp;src="images/xyz.png"> 
  26.  
  27. &nbsp;</logo> 
  28.  
  29. &nbsp;<nav> 
  30.  
  31. &nbsp;<html:a&nbsp;href="/img1">a1</a> 
  32.  
  33. &nbsp;<html:a&nbsp;href="/img2">a2</a> 
  34.  
  35. &nbsp;</nav> 
  36.  
  37. &nbsp;</header> 
  38.  
  39. &nbsp;<content> 
  40.  
  41. &nbsp;<article> 
  42.  
  43. &nbsp;<h1>Heading&nbsp;of&nbsp;main&nbsp;article</h1> 
  44.  
  45. &nbsp;<h2>Sub-heading&nbsp;of&nbsp;main&nbsp;article</h2> 
  46.  
  47. &nbsp;<p>[...]</p> 
  48.  
  49. &nbsp;<p>[...]</p> 
  50.  
  51. &nbsp;</article> 
  52.  
  53. &nbsp;<article> 
  54.  
  55. &nbsp;<h1>The&nbsp;concept&nbsp;of&nbsp;HTML6</h1> 
  56.  
  57. &nbsp;<h2>Understanding&nbsp;the&nbsp;basics</h2> 
  58.  
  59. &nbsp;<p>[...]</p> 
  60.  
  61. &nbsp;</article> 
  62.  
  63. &nbsp;</content> 
  64.  
  65. &nbsp;<footer> 
  66.  
  67. &nbsp;<copyright>This&nbsp;site&nbsp;is&nbsp;©&nbsp;to&nbsp;Anonymous&nbsp;2014</copyright> 
  68.  
  69. &nbsp;</footer> 
  70.  
  71. &nbsp;</html:body> 
  72.  
  73. &nbsp;</html:html> 

在上面的代碼中,你也許注意到了一些奇怪的<html:x>標(biāo)簽,它們是 W3C 和 HTML6 規(guī)范中在命名空間里定義的標(biāo)簽。例如:<html:title>負(fù)責(zé)設(shè)定你瀏覽器的標(biāo)題欄文字,<html:media>負(fù)責(zé)顯示圖片等等。用戶可以自己定義標(biāo)簽以便 JavaScript 和 CSS 識別和處理,這樣頁面代碼會更易讀,語義更清晰。

HTML6 APIs

HTML6 的標(biāo)簽前帶有命名空間,如:<html:html>, <html:head>等等。

1. <html:html>

  1. <!DOCTYPE&nbsp;html> 
  2.  
  3. &nbsp;<html:html>//&nbsp;this&nbsp;is&nbsp;equivalent&nbsp;to&nbsp;<html>&nbsp;tag&nbsp;written&nbsp;in&nbsp;previous&nbsp;HTML&nbsp;versions 
  4.  
  5. &nbsp;<!--&nbsp;sample&nbsp;of&nbsp;HTML&nbsp;document&nbsp;--> 
  6.  
  7. &nbsp;</html:html> 

2. <html:head> 和 <head> 標(biāo)簽一樣。

  1. <!DOCTYPE&nbsp;html> 
  2.  
  3. &nbsp;<html:html> 
  4.  
  5. &nbsp;<html:head> 
  6.  
  7. &nbsp;<!--&nbsp;Main&nbsp;content&nbsp;would&nbsp;come&nbsp;here,&nbsp;like&nbsp;the&nbsp;<html:title>&nbsp;tag&nbsp;--> 
  8.  
  9. &nbsp;</html:head> 
  10.  
  11. &nbsp;</html:html> 

3. <html:title> 和 <title> 標(biāo)簽類似。

  1. <!DOCTYPE&nbsp;html> 
  2.  
  3. &nbsp;<html:html> 
  4.  
  5. &nbsp;<html:head> 
  6.  
  7. &nbsp;<html:title>A&nbsp;Look&nbsp;Into&nbsp;HTML6</html:title> 
  8.  
  9. &nbsp;</html:head> 
  10.  
  11. &nbsp;</html:html> 

4. <html:meta> 和 <meta> 標(biāo)簽類似,不同之處在于,在 HTML5 中你只能使用標(biāo)準(zhǔn)的元數(shù)據(jù)類型,如:”keywords”, “description”, “author”等,而在 HTML6 中你可以使用任何元數(shù)據(jù)類型。

  1. <!DOCTYPE&nbsp;html> 
  2.  
  3. &nbsp;<html:html> 
  4.  
  5. &nbsp;<html:head> 
  6.  
  7. &nbsp;<html:title>A&nbsp;Look&nbsp;Into&nbsp;HTML6</html:title> 
  8.  
  9. &nbsp;<html:meta&nbsp;type="description"&nbsp;value="HTML&nbsp;example&nbsp;with&nbsp;namespaces"> 
  10.  
  11. &nbsp;</html:head> 
  12.  
  13. &nbsp;</html:html> 

5. <html:link> 和 HTML6 之前版本的 <link> 標(biāo)簽類似。

  1. <!DOCTYPE&nbsp;html> 
  2.  
  3. &nbsp;<html:html> 
  4.  
  5. &nbsp;<html:head> 
  6.  
  7. &nbsp;<html:title>A&nbsp;Look&nbsp;Into&nbsp;HTML6</html:title> 
  8.  
  9. &nbsp;<html:link&nbsp;src="js/mainfile.js"&nbsp;title="Script"&nbsp;type="text/javascript"> 
  10.  
  11. &nbsp;</html:head> 
  12.  
  13. &nbsp;</html:html> 

6. <html:body> 和 <body> 標(biāo)簽一樣。

  1. <!DOCTYPE&nbsp;html> 
  2.  
  3. &nbsp;<html:html> 
  4.  
  5. &nbsp;<html:head> 
  6.  
  7. &nbsp;<html:title>A&nbsp;Look&nbsp;Into&nbsp;HTML6</html:title> 
  8.  
  9. &nbsp;</html:head> 
  10.  
  11. &nbsp;<html:body> 
  12.  
  13. &nbsp;<!--&nbsp;This&nbsp;is&nbsp;where&nbsp;your&nbsp;website&nbsp;content&nbsp;is&nbsp;placed&nbsp;--> 
  14.  
  15. &nbsp;</html:body> 
  16.  
  17. &nbsp;</html:html> 

7. <html:a> 和 <a> 標(biāo)簽類似,區(qū)別是 <html:a> 只有 “href” 一個屬性。

  1. <!DOCTYPE&nbsp;html> 
  2.  
  3. &nbsp;<html:html> 
  4.  
  5. &nbsp;<html:head> 
  6.  
  7. &nbsp;<html:title>A&nbsp;Look&nbsp;Into&nbsp;HTML6</html:title> 
  8.  
  9. &nbsp;</html:head> 
  10.  
  11. &nbsp;<html:body> 
  12.  
  13. &nbsp;<html:a&nbsp;href="http://siteurl">Go&nbsp;to&nbsp;siteurl.com!</html:a> 
  14.  
  15. &nbsp;</html:body> 
  16.  
  17. &nbsp;</html:html> 

8. <html:button> 和 <button> 及 <input type=”button”> 一樣。

  1. <!DOCTYPE&nbsp;html> 
  2.  
  3. &nbsp;<html:html> 
  4.  
  5. &nbsp;<html:head> 
  6.  
  7. &nbsp;<html:title>A&nbsp;Look&nbsp;Into&nbsp;HTML6</html:title> 
  8.  
  9. &nbsp;</html:head> 
  10.  
  11. &nbsp;<html:body> 
  12.  
  13. &nbsp;<html:button>Click&nbsp;Here</html:button> 
  14.  
  15. &nbsp;</html:body> 
  16.  
  17. &nbsp;</html:html> 

9. <html:media> 涵蓋 <img>, <video>, <embed> 等標(biāo)簽的所有功能。<html:media> 的好處是你不用根據(jù)不同的媒體文件類型使用不同的標(biāo)簽,媒體的類型由瀏覽器從文件內(nèi)容(類型屬性,擴(kuò)展名,和MIME type)中來判斷。

  1. <!DOCTYPE&nbsp;html> 
  2.  
  3. &nbsp;<html:html> 
  4.  
  5. &nbsp;<html:head> 
  6.  
  7. &nbsp;<html:title>A&nbsp;Look&nbsp;Into&nbsp;HTML6</html:title> 
  8.  
  9. &nbsp;</html:head> 
  10.  
  11. &nbsp;<html:body> 
  12.  
  13. &nbsp;<!--&nbsp;Image&nbsp;would&nbsp;come&nbsp;here&nbsp;--> 
  14.  
  15. &nbsp;<html:media&nbsp;src="img1/logo.jpg"&nbsp;type="image"> 
  16.  
  17. &nbsp;<!--&nbsp;Video&nbsp;doesn't&nbsp;need&nbsp;a&nbsp;type&nbsp;--> 
  18.  
  19. &nbsp;<html:media&nbsp;src="videos/slide.mov"> 
  20.  
  21. &nbsp;</html:body> 
  22.  
  23. &nbsp;</html:html> 

標(biāo)簽類型(Tag types)概述

和 HTML5 一樣, HTML6 也有兩種標(biāo)簽類型:單標(biāo)簽(single tag) 和雙標(biāo)簽(double tag)

  1. <html:meta&nbsp;type="author"&nbsp;content="single&nbsp;tag"> 
  2.  
  3. &nbsp;<html:meta&nbsp;type="author"&nbsp;content="double&nbsp;tag"&nbsp;/> 

單標(biāo)簽不需要結(jié)束符’/’

結(jié)語

HTML6 規(guī)范還未發(fā)布,本文原作者Oscar Godson 只是為我們提供了一個對 HTML6 規(guī)范的展望,或者說他希望 HTML6 能夠支持的一些新特性。

原文鏈接:A Look Into HTML6 – What Is It, and What Does it Have to Offer?

原文地址:http://www.udpwork.com/item/13608.html

責(zé)任編輯:張偉 來源: 酷 殼 – CoolShell.cn
相關(guān)推薦

2015-03-30 09:26:24

JavaScriptHTML6

2021-05-26 10:19:01

jreJava應(yīng)用程序

2015-03-30 14:53:12

HTML6JavaScript一片嘩然

2014-06-19 14:49:37

iCloud認(rèn)證令牌密碼

2017-09-18 11:51:50

2014-11-06 14:48:42

GoogleFacebook

2010-08-10 09:08:29

WebSocketsHTML 5

2010-03-03 08:36:49

HTML 5 Web

2009-09-08 13:47:11

SproutCoreHTML 5應(yīng)用框架

2019-04-09 10:45:18

IPv6運(yùn)營商協(xié)議

2011-09-27 17:37:22

2023-01-04 11:39:45

2017-10-20 12:18:02

HTML5代碼header

2020-08-04 17:12:47

5G6G數(shù)據(jù)傳輸

2012-11-15 09:59:35

HTML5WebHTML5特效

2015-06-17 14:42:04

ASP.NET

2018-11-27 14:57:00

IPv6IPv4網(wǎng)絡(luò)

2012-02-29 15:46:48

HTML 5

2023-05-05 07:10:42

IPv6互聯(lián)網(wǎng)

2019-10-18 09:24:29

WiFi5GWiFi6
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號