HTML5 新增通用屬性

來源:互聯網
上載者:User

標籤:

一:HTML5保留的常用元素

7. 表格相關元素。表格在html裡還算重要的了。   <table>  :用於表格定義。    cellpadding: 儲存格內容和儲存格邊框距離    cellspacing: 儲存格間距    width      : 表格寬度  <caption>: 表格標題最多隻額能包含一個。  <thead>  : 表格頭,可以有多個。  <tfoot>  : 表格腳。  <tbody>  : 表格體。值能包含<tr>  <tr>     : 行  <td>     : 列    colspan: 儲存格跨多少個列    rowspan: 儲存格跨多少個行    height : 儲存格高度    width  :儲存格寬度  <th>     : 頁首a  栗子

[html] view plaincopyprint?
  1. <html>  
  2. <head>  
  3.  <title>表格栗子</title>  
  4. </head>  
  5. <body>  
  6.  <table border=1>  
  7.   <caption>學生升級表</caption>  
  8.   <tr>  
  9.    <th>姓名</th>  
  10.    <th>級數</th>  
  11.    <th>教練  
  12.   </tr>  
  13.   <tr>  
  14.    <td>小黃</td>  
  15.    <td>黑帶一段</td>  
  16.    <td rowspan=2>大佬</td>  
  17.   </tr>  
  18.   <tr>  
  19.    <td>小紅</td>  
  20.    <td>白帶X段</td>  
  21.   </tr>  
  22.  </table>  
  23. </body>  
  24. </html>  
<html><head> <title>表格栗子</title></head><body> <table border=1>  <caption>學生升級表</caption>  <tr>   <th>姓名</th>   <th>級數</th>   <th>教練  </tr>  <tr>   <td>小黃</td>   <td>黑帶一段</td>   <td rowspan=2>大佬</td>  </tr>  <tr>   <td>小紅</td>   <td>白帶X段</td>  </tr> </table></body></html>

  8. 架構相關元素     html5刪除了<frameset><frame><noframes>這3個標籤。  <iframe> : 內聯架構。可以顯示網頁或者別的。    src    : URL源  栗子

[html] view plaincopyprint?
  1. <html>  
  2. <head>  
  3.  <title>架構栗子</title>  
  4. </head>  
  5. <body>  
  6.  <iframe src="www.baidu.com" width=400 height=300 />  
  7. </body>  
  8. </html>  
<html><head> <title>架構栗子</title></head><body> <iframe src="www.baidu.com" width=400 height=300 /></body></html>
二 : HTML5新增的通用屬性

1. contentEditable 允許開發人員直接編輯HTML元素內容的開關量。true:false        具有繼承性

[html] view plaincopyprint?
  1. <html>  
  2. <head>  
  3.  <title>ContentEditable</title>  
  4. </head>  
  5. <body>  
  6.  <div contentEditable="true">  
  7.   <table border=1>  
  8.    <caption>學生升級表</caption>  
  9.    <tr>  
  10.     <th>姓名</th>  
  11.     <th>級數</th>  
  12.     <th>教練  
  13.    </tr>  
  14.    <tr>  
  15.     <td>小黃</td>  
  16.     <td>黑帶一段</td>  
  17.     <td rowspan=2>大佬</td>  
  18.    </tr>  
  19.    <tr>  
  20.     <td>小紅</td>  
  21.     <td>白帶X段</td>  
  22.    </tr>  
  23.   </table>  
  24.  </div>  
  25. </body>  
  26. </html>  
<html><head> <title>ContentEditable</title></head><body> <div contentEditable="true">  <table border=1>   <caption>學生升級表</caption>   <tr>    <th>姓名</th>    <th>級數</th>    <th>教練   </tr>   <tr>    <td>小黃</td>    <td>黑帶一段</td>    <td rowspan=2>大佬</td>   </tr>   <tr>    <td>小紅</td>    <td>白帶X段</td>   </tr>  </table> </div></body></html>

    這樣子表格就可以寫了     2. designMode屬性     相當於全域的contentEditable屬性。所有東西都可以編輯。  (有點危險,可以拿網頁來當寫字板啦。)     3. hidden屬性      可以把標籤隱藏。很好理解吧。   栗子

[html] view plaincopyprint?
  1. <html>  
  2. <head>  
  3.  <title>hidden</title>  
  4. </head>  
  5. <body>  
  6.  <div id="baidu" hidden="true">www.baidu.com</div>  
  7.  <button  onclick="var baidu=document.getElementById(‘baidu‘);  
  8.   baidu.hidden=!baidu.hidden;">安安按鈕</button>  
  9. </body>  
  10. </html>  
<html><head> <title>hidden</title></head><body> <div id="baidu" hidden="true">www.baidu.com</div> <button  onclick="var baidu=document.getElementById(‘baidu‘);  baidu.hidden=!baidu.hidden;">安安按鈕</button></body></html>

 哎。ie9這個屬性不能用。好吧。不了。     4. spellcheck屬性     對輸入文本做拼字檢測。

[html] view plaincopyprint?
  1. <html>  
  2. <head>  
  3.  <title>spellcheck</title>  
  4. </head>  
  5. <body>  
  6.  <textarea spellcheck="true" row="10" cols="40" >  
  7.  </textarea>  
  8. </body>  
  9. </html>  

HTML5 新增通用屬性

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.