列表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
列表可以嵌套. 在每个列表项中,你还可以含有多个段落,每个段落含有嵌套列表.
以上就是HTML 初学者指南(三)的内容,更多相关内容请关注PHP中文网(www.php.cn)!
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号