你的位置:首页 > 技术文章

HTML 初学者指南(3)

2007-06-24 浏览:(3593) 技术文章 评论(0)

列表Lists

HTML 支持不编号 unnumbered, 编号numbered, 和定义definition 三种列表. 你也可以嵌套列表, 但是不要嵌套过多,否则会使读者感到不清晰。 

不编号列表Unnumbered Lists 

制作一个不编号的,公告式列表, 

用开始标记 <UL> ( unnumbered list 的简记) 开始 

输入 <LI> (list item) 标记,后面跟独立的项; 不需使用 </LI> 标记 

用 </UL> 标记结束整个列表 

下面是一个有三个项的列表: 

<UL>

<LI> apples

<LI> bananas

<LI> grapefruit

</UL> 

输出形式为: 

apples 

bananas 

grapefruit 

<LI> 项可以含有多个段落. 用段落标记 <P> 指明. 

编号列表Numbered Lists 

编号列表 (也称为 有序列表ordered list) 和不编号列表相同, 只是用 <OL> 代替 <UL>. 各项同样用 <LI> 标记. 下面的 HTML 代码: 

<OL>

<LI> oranges

<LI> peaches

<LI> grapes

</OL> 

产生的输出为: 

oranges 

peaches 

grapes 

定义列表Definition Lists 

定义列表 (编码为 <DL>) 通常含有交替出现的 定义术语definition term (编码为 <DT>) 和定义描述definition definition (编码为 <DD>). Web 浏览器通常另起一行显示定义描述. 

下面是一个定义列表的例子: 

<DL>

<DT> NCSA

<DD> NCSA, the National Center for Supercomputing Applications,

is located on the campus of the University of Illinois 

at Urbana-Champaign. 

<DT> Cornell Theory Center

<DD> CTC is located on the campus of Cornell University in Ithaca,

New York. 

</DL> 

输出形式为: 

NCSA 

NCSA, the National Center for Supercomputing Applications, is located on the campus of the University of Illinois at Urbana-Champaign. 

Cornell Theory Center 

CTC is located on the campus of Cornell University in Ithaca, New York. 

<DT> 和 <DD> 项可以包含多个段落 (用 <P> 标记指示), 列表, 或其他的定义信息. 

COMPACT 属性可能会被经常使用,如果你的定义术语很简短的话. 例如,如果你想显示一些计算机选项, 它们可以和定义的开始处于同一行中. 

<DL COMPACT>

<DT> -i

<DD>invokes NCSA Mosaic for Microsoft Windows using the 

initialization file defined in the path

<DT> -k

<DD>invokes NCSA Mosaic for Microsoft Windows in kiosk mode

</DL> 

输出形式为: 

-i 

invokes NCSA Mosaic for Microsoft Windows using the initialization file defined in the path. 

-k 

invokes NCSA Mosaic for Microsoft Windows in kiosk mode. 

嵌套列表Nested Lists 

列表可以嵌套. 在每个列表项中,你还可以含有多个段落,每个段落含有嵌套列表.

  • 发表评论
  • 查看评论
【暂无评论!】

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。