以前Html在doctype格式為
<!DOCTYPE HTML PUBLIC ........>
現在Html 5在doctype格式為
<!DOCTYPE html>
以前Html在meta格式為
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
現在Html 5在meta格式為
<meta charset="UTF-8">
以前Html在javascript格式為
<script type="text/javascript" src="file.js"></script>
現在Html 5在javascript格式為
<script src="file.js"></script>
以前Html在link格式為
<link rel="stylesheet" type="text/css" href="file.css">
現在Html 5在link格式為
<link rel="stylesheet" href="file.css">
Html 5 新增標籤
<section></ section> 區塊
<header></header> 開頭
<nav></nav> 導覽
<footer><footer> 尾端
<aside></aside> 側欄
<article></article> 文章
<main></main> 內容
<figure></figure> 放置圖片
<figcaption></figcaption> 圖片內容
<time></time> 時間
Html 5 input type 新增
search 搜尋
email 郵件
url連結
date 日期
tel 電話
number 數字
range 範圍
month 月
week 週
time 時間
datetime-local 現在日期時間
color 顏色
如果瀏覽器不支援,type預設為text
Html 5 form elements新增
datalist搜尋清單
以下為製作搜尋範例
<input type="text" list="browsers">
<datalist id="browsers">
<option value="Chrome">
<option value="Firefox">
<option value="Internet Explorer">
...
</datalist>
Html 5 form attributes新增
placeholder輸入提示
以前Html格式
<input type="text" value="Enter your name">
現在Html 5格式
<input type="text" placeholder="Enter your name">
autofocus浮標鎖定
Html 5格式
<input type="text" autofocus>
required輸入回應
以下為required範例
<input type="text" name="usrname" required>
<input type="submit">
required參考網址: http://www.w3schools.com/tags/att_input_required.asp
pattern輸入格式
以下為pattern範例
<input type="text" name="code" pattern="[A-Z]{3}" title="Three letter A-Z">
<input type="submit">
pattern參考網址: http://www.w3schools.com/tags/att_input_pattern.asp