2017年1月4日 星期三

HTML/CSS

  1. HTML5 Forms
  2. HTML5form做了一些改變,如下
  3. 新的input type
  4. 新的form 元件
  5. 新的form 屬性
  6. 增加的input type有以下13種,如果瀏覽器不支援以下類型,會預設為text,讓網頁製作更為方便
  7. Search --手機鍵盤上會有search
  8. Email --手機鍵盤上會有@、.符號
  9. URL --手機鍵盤上會有.、/、.com符號
  10. Tel --手機跳出數字鍵盤
  11. Number --手機跳出數字鍵盤,桌機輸入框旁有加減鈕
  12. Range --會出現一可往左右拉的選取條
  13. Date --手機上會跳出日期選擇,桌機出現日曆
  14. Month --與Date相似,但只能選月份
  15. Week --與Date相似,但只能選某星期
  16. Time --可選時間
  17. Datetime --可選時間與日期
  18. Datetime-local
  19. Color --可以呼叫調色盤
  20. Datalist
  21. datalist可以在網頁上建立一個輸入框,與select有些類似,但使用者是以文字輸入,當使用者輸入第一個字時,下方會自動跳出開頭一樣的選項(類似google)
  22. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  23. <input type="text" list="browers" /> --listid要相同
  24. <datalist id="browers"> --idlist要相同
  25. <option value="Firefox"> --選項
  26. <option value="Chrome">
  27. ....
  28. </datalist>
  29. form屬性
  30. HTML5中,form增加了14種屬性,以下介紹 PlaceholderAutofocusRequiredPattern 4
  31. Placeholder
  32. Placeholderinput的預設值,用來說明要輸入的資料為何(Email、電話...),只要使用者輸入資料,預設值就會自動刪除
  33. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  34. <input type="text"placeholder="Enter your Email.."/>
  35. Autofocus
  36. 當網頁開啟時,焦點會自動移至autofocusinput
  37. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  38. <input type="text" autofocus />
  39. Required
  40. input中有required屬性,那麼該input必須要有值才可以送出,如果沒有輸入值是無法送出的
  41. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  42. <input type="text" required />
  43. Pattern
  44. input中有Pattern屬性,那麼該input有限制的格式,範例要輸入0-9組成的三位數數值,如果沒有符合條件,是無法送出的
  45. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  46. <input type="text" pattern="[0-9]{3}" /> --格式是3位數的0-9數字

沒有留言:

張貼留言