起始標籤 | 結束標籤 |
---|---|
選擇性的 | 選擇性的 |
<head> 有幾個屬性
屬性 | 值 | Deprecated or Obsolete |
---|---|---|
profile | 提供網頁資訊的網址 | HTML 4 only, Obsolete in HTML 5 |
例如
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | < html > < head > < title >網頁標題</ title > </ head > < body > < p >You ever have that feeling where you're not sure if you're awake or still dreaming?</ p > < p >A prison for your mind.</ p > < p >Free your mind.</ p > < p >Believe the unbelievable.</ p > < p >There is no spoon.</ p > < p >I can only show you the door, you have to walk through it.</ p > < p >Choice. The problem is choice.</ p > < p >Then tomorrow we may all be dead, but how would that be different from any other day?</ p > < p >I have dreamed a dream, but now that dream has gone from me.</ p > < p >Choice is an illusion, created between those with power, and those without.</ p > < p >Because I choose to.</ p > < p >Everything that has a beginning has an end.</ p > </ body > </ html > <!-- 《程式語言教學誌》的範例程式 檔名:example01.html 功能:示範 HTML 4.01 標記語言的使用 作者:張凱慶 時間:西元 2011 年 5 月 --> |
利用瀏覽器 (broswer) 開啟如下

此例中, <head></head> 成對標籤 (tag) 所圍住的元素 (element) 這裡只有 <title> ,表示文件標題,我們可以在網頁的標題列看到「網頁標題」的文字。
通常 <head></head> 會使用以下元素
- <title></title>
- <meta />
- <link />
- <script></script>
- <style></style>
<title></title> 在上例中已有使用, <meta /> 為文件資訊,可提供時間日期、關鍵字、電子郵件與作者姓名等相關內容。 <link /> 用來連結樣式表 (style sheet) , <style></style> 為自訂的樣式表, <script></script> 則是放置腳本語言 (script language) 的地方,或是外連其他伺服器的腳本程式。
例如下例中,我們加入 <style> 自訂樣式表
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | < html > < head > < title >網頁標題</ title > < style > p { background-color: black; color: white; } </ style > </ head > < body > < p >You ever have that feeling where you're not sure if you're awake or still dreaming?</ p > < p >A prison for your mind.</ p > < p >Free your mind.</ p > < p >Believe the unbelievable.</ p > < p >There is no spoon.</ p > < p >I can only show you the door, you have to walk through it.</ p > < p >Choice. The problem is choice.</ p > < p >Then tomorrow we may all be dead, but how would that be different from any other day?</ p > < p >I have dreamed a dream, but now that dream has gone from me.</ p > < p >Choice is an illusion, created between those with power, and those without.</ p > < p >Because I choose to.</ p > < p >Everything that has a beginning has an end.</ p > </ body > </ html > <!-- 《程式語言教學誌》的範例程式 檔名:example04.html 功能:示範 HTML 4.01 標記語言的使用 作者:張凱慶 時間:西元 2011 年 5 月 --> |
網頁顯示結果如下

我們的自訂樣式表把 <p> 元素的背景改成黑色,文字改成白色。
中英文術語對照 | |
---|---|
瀏覽器 | broswer |
標籤 | tag |
元素 | element |
樣式表 | style sheet |
腳本語言 | script language |
您可以繼續參考
HTML 基本概念
- 元素與屬性
- 絕對路徑與相對路徑
- 度量與單位
- 網頁顏色
- 網頁字元索引
- 文件型態定義
- <html> - 文件標籤
- <head> - 文件標頭
- <title> - 標題
- <meta /> - 資訊
- <link /> - 外連樣式表
- <script> - 腳本程式
- <style> - 樣式
- <base> - 基本路徑
- <body> - 文件主體
- <address> - 作者資訊
相關目錄
HTML 4.01 快速導覽 - 目錄
HTML, CSS 教材
首頁
參考資料
沒有留言:
張貼留言