4.HTML 經常使用標籤及屬性

1. 連接

標籤:
    <a></a>
屬性:
    href:連接地址
    target:打開方式
        _blank:新標籤頁打開
        _self:當前頁面打開(默認)
    title:連接提示
複製代碼

2. 文本標記

標題元素

<h1></h1>
<h2></h2>
<h3></h3>
<h4></h4>
<h5></h5>
<h6></h6>
複製代碼

文本樣式

斜體:
    <i></i>
粗體:
    <b></b>
刪除線:
    <s></s>
下劃線:
    <u></u>
上標:
    <sup></sup>
下標:
    <sub></sub>
複製代碼

段落元素

<p></p>
複製代碼

換行元素

<br/>
複製代碼

分割線元素

標籤:
    <hr/>
屬性:
    size:尺寸
    width:寬度
    color:顏色
    align:水平對齊方式
        left/center/right
複製代碼

分區元素

塊分區元素:
    <div></div>
行內分區元素:
    <span></span>
複製代碼

塊級元素與行內元素

塊級元素:
    <p></p>
    <div></div>
    <h1~6></h1~6>
行內元素:
    <img/>
    <a></a>
    <i></i>
    <b></b>
    <s></s>
    <u></u>
    <sub></sub>
    <sup></sup>
    <span></span>
複製代碼

3. 圖像

標籤:
    <img/>
屬性:
    src:圖片地址
    width:圖像寬度
    height:圖像高度
複製代碼

4.表格

標籤:
    <table></table>
屬性:
    width:寬度
    height:高度
    border:邊框寬度
    bgcolor:背景顏色
    cellpadding:內邊距
    cellspacing:外邊距
    align:水平對齊方式
        left/center/right
複製代碼

子元素

標籤:
    <tr></tr>(建立錶行)
屬性:
    bgcolor:背景顏色
    align:水平對齊方式
        left/center/right
    valign:垂直對齊方式
        top/middle/bottom

標籤:
    <td></td>(建立單元格)
屬性:
    width:寬度
    height:高度
    align:水平對齊方式
    valign:垂直對齊方式

<caption></caption>(表格標題)
<th></th>(列標題)
<thead></thead>(表頭)
<tbody></tbody>(表主體)
<tfoot></tfoot> (表尾)
複製代碼

5. 列表

有序列表

<ol>
    <li></li>
</ol>
屬性:
    type:標識類型,默認爲數字排列
        1(默認)/a/A/i/I
    start:定義起始值,默認從1開始
複製代碼

無序列表

<ul>
    <li></li>
</ul>
屬性:
    type:標識類型
        disc(默認)/circle/square/none
複製代碼

自定義列表

<dl>
    <dt>列表中的標題</dt>
    <dd>列表中的數據</dd>
</dl>
複製代碼

6. 表單

標籤:
    <form></form>
屬性:
    name:表單名稱
    action:提交地址
    method:提交方式
        get/post
複製代碼

input 元素

標籤:
    <input/>
屬性:
    name:控件名稱
    type:控件類型
    value:值
    disabled:禁用
複製代碼

經常使用表單控件

文本框:
    <input type="text"/>
密碼框:
    <input type="password"/>
    屬性:
        readonly:控件只讀
        maxlength:限制字符數
單選按鈕:
    <input type="radio"/>
複選框:
    <input type="checkbox"/>
    屬性:
        checked:設置默認被選中
提交按鈕:
    <input type="submit"/>
重置按鈕:
    <input type="reset"/>
普通按鈕:
    <input type="button"/>
圖片按鈕:
    <input type="image" src=""/> 
文件選擇框:
    <input type="file"/>
隱藏域:
    <input type="hidden"/>
複製代碼

button 元素

<button>內容</button>
複製代碼

select 和 option 元素

<section name="">
    <option value="" selected></option>
</section>
複製代碼

7. 結構標記

<header></header>
<nav></nav>
<aside></aside>
<article></article>
<section></section>
<footer></footer>
複製代碼
相關文章
相關標籤/搜索