HTML list
HTML supports ordered, unordered and defined lists:
##Ordered list
<ol> tag. Each list item begins with a <li> tag.
List items are marked with numbers.Example
This example demonstrates an ordered list.<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <ol> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ol> <ol start="50"> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ol> </body> </html>Program running result:
HTML unordered list
An unordered list is a list of items marked with bold dots (typically small black circles). Unordered list uses <ul> tagExample
This example demonstrates an unordered list.<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <h4>一個無序列表:</h4> <ul> <li>咖啡</li> <li>茶</li> <li>牛奶</li> </ul> </body> </html>Program running result:
HTML custom list
A custom list is not just a list of items, but a combination of items and their comments. Custom lists start with a <dl> tag. Each custom list item begins with <dt>. The definition of each custom list item begins with <dd>.Example
This example demonstrates a definition list.<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <h2>一個定義列表:</h2> <dl> <dt>計算機</dt> <dd>用來計算的儀器 ... ...</dd> <dt>顯示器</dt> <dd>以視覺方式顯示信息的裝置 ... ...</dd> </dl> </body> </html>Program running result:
#Tips: Paragraphs, line breaks, pictures, and links can be used inside list items and other lists and more.
More examples
This example demonstrates different types of unordered lists.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <h4>Disc 項目符號列表:</h4> <ul type="disc"> <li>蘋果</li> <li>香蕉</li> <li>檸檬</li> <li>桔子</li> </ul> <h4>Circle 項目符號列表:</h4> <ul type="circle"> <li>蘋果</li> <li>香蕉</li> <li>檸檬</li> <li>桔子</li> </ul> <h4>Square 項目符號列表:</h4> <ul type="square"> <li>蘋果</li> <li>香蕉</li> <li>檸檬</li> <li>桔子</li> </ul> </body> </html>
Program running result:
##Example
This example demonstrates different types of ordered lists.<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <h4>字母列表:</h4> <ol type="A"> <li>蘋果</li> <li>香蕉</li> <li>檸檬</li> <li>桔子</li> </ol> <h4>小寫字母列表:</h4> <ol type="a"> <li>蘋果</li> <li>香蕉</li> <li>檸檬</li> <li>桔子</li> </ol> <h4>羅馬字母列表:</h4> <ol type="I"> <li>蘋果</li> <li>香蕉</li> <li>檸檬</li> <li>桔子</li> </ol> <h4>小寫羅馬字母列表:</h4> <ol type="i"> <li>蘋果</li> <li>香蕉</li> <li>檸檬</li> <li>桔子</li> </ol> </body> </html>Program running result:
Example
This example Demonstrates how to nest lists.<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <h4>一個嵌套列表:</h4> <ul> <li>咖啡</li> <li>茶 <ol> <li>紅茶</li> <li>綠茶</li> </ol> </li> <li>牛奶</li> </ul> </body> </html>Program running result:
##HTML list tag Tag Description <ol> Define an ordered list. <ul> Define an unordered list. <li> Define list items. <dl> Definition definition list. ? <dt> Definition definition item. <dd> Definition description.