標題
內容內容內容內容
本文為 HTML 相關筆記,以 HTML5 版本為主,特別標示 HTML5 新標籤、不把已刪除的舊標籤放進來,僅提供查詢,因瀏覽器的支援度更新頻繁,詳細資訊請再參考相關連結並依據所需查證。
原則上大部分的 HTML 標籤可以隨自己喜好選擇,但基於 W3C 對標籤還是有些基礎規範,例如 p 與 ul 同層級,所以不能互包、ol 的下層是 li,不能隨便放其他標籤...等等。因為很多規則是經驗法則,就不一一標示,其實只要對標籤語意有一定的認識,就不會包錯,然後基於 SEO 行銷,使用 HTML5 要注意「語意」上的辨識,所以選擇適當的 HTML 標籤還是很重要的。
注意 IE9 以上的瀏覽器才支援 HTML5 宣告,若要在 IE9 以下使用 HTML5 需用 html5shiv.js 和 respond.js 外掛自動轉換成 HTML4 讀得懂的標籤!或許會注意到有些標籤有「/」結尾,這是因為早期 HTML4 的版本對於單一、沒有結尾的標籤做結束的標示,例如:<br/>,但 HTML5 對於斜線的標示不那麼嚴謹,所以在 HTML5 裡的標籤可以不做斜線結尾。
另外也提供專案常用到的 Meta 設定以及讓各瀏覽器顯示最佳效果的 Hack 筆記喔!😘
<!DOCTYPE HTML>
<html>
<head>
<title>網頁標題</title>
</head>
<body>
網頁內容,會顯示在瀏覽器上~
</body>
</html>
<head>
<meta charset="UTF-8">
<title>網頁標籤</title>
<meta name="description" content="網頁描述">
<meta name="keywords" content="關鍵字1,關鍵字2,關鍵字3">
<meta name="author" content="作者名字">
<base href="http://www.w3schools.com/images/" target="_blank">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<head>
<link rel="stylesheet" type="text/css" href="layout.css">
<style type="text/css">
h1 {color:red;}
p {color:blue;}
</style>
</head>
<body>
<p style="color: green;">行內樣式</p>
</body>
<script src="js/jquery-3.3.1.min.js"></script>
<script>
document.write("Hello Domo!");
</script>
<noscript>您的瀏覽器不支援 JavaScript!</noscript>
標題 h1
標題 h2
標題 h3
標題 h4
標題 h5
標題 h6
The Scream 挪威畫家愛德華·孟克(Edvard Munch)1893 年的作品
我的名字是 Domo DOMO!
跟 HTML 碼顯示空格的樣子一樣耶!
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and line breaks
<pre>
跟 HTML 碼顯示空格的樣子一樣耶!
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and line breaks
</pre>
For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.
For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.
Build a future where people live in harmony with nature.We hope they succeed.
WWF's goal is to: Build a future where people live in harmony with nature.
We hope they succeed.
- Coffee
- Tea
超連結
是菊目菊科多年生草本植物的一個屬。其下約有 40 種,其中大多數原產於東亞,其變異中心在中國。
All pages and graphics on this web site are the property of Domo.
Copyright 2018.
All pages and graphics on this web site are the property of Domo.
2/10
60%
<canvas id="myCanvas" height="100"></canvas>
<script>
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "#FF0000";
ctx.fillRect(0, 0, 80, 80);
</script>
網站短文描述
LOGO
網站短文描述
| 月份 | 收入 | 支出 | 餘額 |
|---|---|---|---|
| 總額 | $90 | ||
| 一月 | $100 | $30 | $70 |
| 二月 | $100 | $50 | $20 |
| 月份 | 收入 | 支出 | 餘額 |
|---|---|---|---|
| 總額 | $90 | ||
| 一月 | $100 | $30 | $70 |
| 二月 | $100 | $50 | $20 |
帳號:
密碼:
信箱:
電話:
網站:
生日:
性別:
訂閱電子報:
月報
雙週報
週報
日報
上傳頭像:
顏色選取:
數字選取:
滑桿範圍:
搜尋方塊:
選擇年月:
選擇年週:
選擇時間:
選擇時間:
輸入時間:
readonly:
required:
disabled:
學歷:
清單內容功能:
留言:
<object data="images/helloworld.swf" width="420"></object>
<object data="images/sample.mp4">
<param name="autoplay" value="true">
</object>
<audio src="images/music.mp3" controls>瀏覽器不支援 audio</audio>
<audio controls preload="none">
<source src="images/music.mp3">
<track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
<track src="subtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
</audio>
<video src="images/sample.mp4" width="240" height="160" controls>瀏覽器不支援 video</video>
<video src="images/sample.mp4" width="240" height="160" poster="images/pic.jpg" controls preload></video>
<video width="240" height="160" controls loop>
<source src="images/sample.mp4" type="video/mp4">
<source src="images/sample.ogg" type='video/ogg'>
</video>