文檔的可見部分在<tbody>和</body>之間。<DOCTYPE html< <html> <head> </head> <body> </body> </html>
標題
標題是由<h1>到</h6>定義的,<h1>最大而<h6>最小。
範例:標題1
標題2
標題3
標題4
標題5
標題6
<h1<標題1</h1> <h2>標題2</h2> .............. <h6>標題6</h6>
段落
段落使用 標籤。
<p<段落</p>
書籤
使用id創建書籤,點擊時會移動到書籤位置。 範例:
超鏈結
超鏈接使用標籤,使用target可以改變視窗開啟方式。 範例:google<a href="https://www.google.com.tw/" target="_blank">google</a>
圖像
鏈接使用標籤,href屬性指向超連結,src指定圖像路徑, alt用在圖片跑不出來時的替代文字,width與height指定高度和寬度。 範例:<img src="github.png" alt="github" width="50" height="50">
網站圖標
在網站標題旁加入小圖標。
背景顏色
background-color屬性定義了HTML元素的背景顏色。 補充:顏色值有幾種使用方式: 井字號兩碼代表一個顏色 例: #ff6347 RGB三原色0~255之間 例: RGB(255, 99, 71) hsl色度彩度 例: hsl(9, 100%, 64%)
文字背景顏色
background-color也可以使用在文字上。 範例:橘色的文字背景
橘色的文字背景
文字邊框顏色
border用於文字邊框的顏色。 範例:紫色的邊框
紫色的邊框
風格屬性
style屬性用於向元素添加樣式,例如顏色、字體、大小、對齊等。 範例:這是紫色.
這是深藍.
第一種字體.
第二種字體.
大
小
對齊中間.
對齊右邊.
<p style="color:#7C00D6;">紫色.</p> <p style="color:#0000D6;">深藍.</p> <p style="font-family:STKaiti;">第一種字體.</p> <p style="font-family:SimSun;">第二種字體.</p> <p style="font-size:250%;">大</p> <p style="font-size:50%;">小</p> <p text-align:center;">對齊中間.</p> <p text-align:right;">對齊右邊.</p>
語言屬性
在中使用lang屬性,以聲明網頁的語言和國家,為了幫助搜索。 <html lang="en-US">
標題屬性
當鼠標懸停在元素上時,title屬性的值將顯示。 範例:將鼠標移到這裡!
將鼠標移到這裡!
表格
範例:
標題一 | 標題二 | 標題三 |
---|---|---|
內容一 | 內容二 | 內容三 |
內容四 | 內容五 | 內容六 |
標題一 | 標題二 | 標題三 |
---|---|---|
內容一 | 內容二 | 內容三 |
內容四 | 內容五 | 內容六 |
無序列表範例:
無序列表範例:
- 列表四
- 列表五
- 列表六
範例:這是
換行
以固定寬度的字體保留了空格和換行符。
範例: 可以保留 空格 還有換行
範例:粗體文字
重要的文字!
斜體文字
強調斜體文字
較小的文字這是螢光筆
這是
刪除線這是底線
這是下標
這是上標
粗體文字 重要的文字! 斜體文字 強調斜體文字 較小的文字 這是螢光筆
這是
刪除線這是底線
這是下標
這是上標
會以引用的格式顯示文字,而網址寫進起始標籤裡。
範例:
面對光明,陰影就在我們身後。-海倫凱勒
面對光明,陰影就在我們身後。-海倫凱勒
標籤會於文字中插入雙引號。
範例:I spent the morning reading Faulkner’s
Barn Burning,which seemed to be about a pyromaniac.
I spent the morning reading Faulkner’sBarn Burning,
which seemed to be about a pyromaniac.
範例:只有這會顯示
只有這會顯示
標籤,但不保留換行因此可以加。
舉例:
x = 10;
y = 9;
z = x + y;
x = 10;
y = 9;
z = x + y;