HTML語言剖析(六)清單標記

來源:互聯網
上載者:User

HTML語言剖析

清單標記

<OL> <LI>
<UL>
<MENU> <DIR>
<DL> <DT> <DD> 
■ <OL> <LI> : ▲Top
 
<OL>稱為順序清單標記。<LI>則用以標示清單項目。
所謂順序清單就是在每一項前面加上 1,2,3... 等數目,又稱編號清單。
<OL> 的參數設定(常用):
例如: <ol type="i" start="4"></ol>

type="i"
設定數目款式,其值有五種,請參考 右表,內定為 type="1"。
start="4"
設定開始數目,不論設定了哪一數 目款式,其值只能是 1,2,3.. 等整 數,內定為 start="1"。

Type                    Numbering style
1            arabic numbers       1, 2, 3, ...
a            lower alpha          a, b, c, ...
A            upper alpha          A, B, C, ...
i            lower roman          i, ii, iii, ...
I            upper roman          I, II, III, ...
 
<LI> 的參數設定(常用):
例如: <li type="square" value="4">

type="square"
只適用於非順序清單,設定符號款式,其值有三種,如下,內定為 type="disc":
符號  是當 type="disc" 時的列項符號。
符號  if" width=10 height=10 border=0> 是當 type="circle" 時的列項符號。
符號  是當 type="square" 時的列項符號。
value="4"
只適用於順序清單,設定該一項的數目,其後各項將以此作為起始數目而遞增, 但前面各項則不受影響,其值只能是 1,2,3.. 等整數,沒有內定值。

例子:
HTML Source Code (原始碼)    瀏覽器顯示結果
My best friends:               My best friends:
<ol>
<li>Michelle Wei               1.Michelle Wei
<li>Michael Wan                2.Michael Wan
<li>Gloria Lam                 3.Gloria Lam
</ol>  

■ <UL> : ▲Top
 
<UL>稱為無序清單標記。
所謂無序清單就是在每一項前面加上 、、 等符號,故又稱符號清單。
<UL> 的參數設定(常用):
例如: <UL type="square">

type="square"
設定符號款式,其值有三種,如下,內定為 type="disc":
符號  是當 type="disc" 時的列項符號。
符號  是當 type="circle" 時的列項符號。
符號  是當 type="square" 時的列項符號。
注意:由於 <UL> 及 <LI> 都有 type 這個參數,兩者儘可能選用其一。

例子:
HTML Source Code (原始碼)    瀏覽器顯示結果
My Homepages:                  My Homepages:
<ul>
<li>Penpals Garden             Penpals Garden
<li>ICQ Garden                 ICQ Garden
<li>Software City              Software City
<li>Creation of Webpage        Creation of Webpage
</ul>  
 
■ <MENU> <DIR> : ▲Top
 
這兩個標記都不為 W3C 所贊同,希望用者能以 <ul> 及 <ol> 代之。
<MENU> 及 <DIR>,基本上它和 <ul> 是一樣的,在一些特別的瀏覽器可能表現出 <ol> 的 效果,於舊版的 IE 或 NC 標記 <DIR> 不顯示符號或數目。兩標記的用法與 <ul> 完全一 樣。

例子:
HTML Source Code (原始碼)         瀏覽器顯示結果
My Homepages:                       My Homepages:
<dir>
<li>Penpals Garden                  Penpals Garden
<li>ICQ Garden                      ICQ Garden
<li>Software City                   Software City
<li>Creation of Webpage             Creation of Webpage
</dir>  
 
■ <DL> <DT> <DD> : ▲Top
 
<DL>稱為定義清單標記。 <DT> 用以標示定義條目,<DD> 則用以標示定義內容。
所謂定義清單就是一種分二層的項目清單,其不故符號及數目。
三個標記都沒有常用的參數。而 <DT> <DD> 可以獨立使用,只是一些舊的瀏覽器並不支 援,如 IE 3.0。常用的如 <DD> 標記可用以製造段落第一個字前面的空白。

例子:
原始碼 <dl>
<dt>How to use Definition List
<dd>First, you should not place paragraph tag right after or before a list structure or between the items of a list. In cerntain contexts, use of extra paragraph tags should always be avoided, when you realize this concept, it is quit easy to write a HTML.
<dt>Other things to know
<dd>We usually put only ONE Definition tag following the Definition Term tag, more than one DD tag is not recommanded. Besides, unlike Definition List is a nonempty tag, both Definition Term and Definition Description are empty tags.
</dl> 
顯示結果
How to use Definition List
First, you should not place paragraph tag right after or before a list structure or between the items of a list. In cerntain contexts, use of extra paragraph tags should always be avoided, when you realize this concept, it is quit easy to write a HTML.
Other things to know
We usually put only ONE Definition tag following the Definition Term tag, more than one DD tag is not recommanded. Besides, unlike Definition List is a nonempty tag, both Definition Term and Definition Description are empty tags.  



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.