当前位置:网站首页>7. 列表标签
7. 列表标签
2022-06-11 03:40:00 【M_qsqsqsq】
7. 列表标签
表格是用来显示数据的,那么==列表 就是用来布局的。==
列表 最大的特点就是整齐、整洁、有序,它作为布局会更加自由和方便。
根据使用情景不同,列表可以分为三大类:无序列表、有序列表和自定义列表。

| 标签名 | 定义 | 说明 |
|---|---|---|
<ul></ul> | 标签项无序 | 里面只能包含<li>标签, 标签没有顺序,使用较多。<li>里面可以包含任何标签 |
<ol></ol> | 标签项有序 | 里面只能包<li>标签, 标签有顺序,使用相对较少。<li>里面可以包含任何标签 |
<dl></dl> | 自定义列表 | 里面只能包含<dt>和<dd>。<dt>和<dd>里面可以放任何标签 |
7.1 无序列表 ( 重点 )
<ul>标签表示HTML页面中项目的无序列表(unordered list),一般会以项目符号呈现列表项,而列表项使用<li>标签定义。
无序列表的基本语法格试如下:
<ul>
<li>列表项1</li>
<li>列表项2</li>
<li>列表项3</li>
...
</ul>
示例:
<h4>我喜欢吃的食物</h4>
<ul>
<!--<ul>标签里只能方<li>标签, 其他标签是不能放的-->
<li><strong>榴莲</strong></li>
<li><em>臭豆腐</em></li>
<li><ins>鲱鱼罐头</ins></li>
</ul>
注意:
无序列表的各个列表项之间没有顺序级别之分,是并列的。
<ul></ul>中只能嵌套<li></li>,直接在<u></ul>标签中输入其他标签或者文字的做法是不被允许的。<li>与</li>之间相当于一个容器,可以容纳所有元素。无序列表会带有自己的样式属性,但在实际使用时,我们会使用CSS来设置。
7.2 有序列表
有序列表(ordered list)即为有排列顺序的列表,其各个列表项会按照一定的顺序排列定义。
在HTML标签中,<ol>标签用于定义有序列表,列表排序以数字来显示,并且使用<li>标签来定义列表项。
有序列表的基本语法格式如下:
<ol>
<li>列表项1</li>
<li>列表项2</li>
<li>列表项3</li>
...
</ol>
示例:
<h4>成绩排名</h4>
<ol>
<li><strong>小明</strong></li>
<li><em>小红</em></li>
<li><ins>小青</ins></li>
</ol>
<ol></ol>中只能嵌套<li></li>, 直接在<ol></ol>标签中输入其他标签或者文字的做法是不被允许的。<li>与</li>之间相当于一个容器,可以容纳所有元素。- 有序列表会带有自己样式属性,但在实际使用时,我们会使用CSS来设置。
7.3 自定以列表 (重点)
自定义列表(definition list)的使用场景:
自定义列表常用于对术语或名词进行解释和描述,定义列表的列表项前没有任何项目符号。
在HTML标签中,<dl>标签用于定义描述列表(或定义列表),该标签会与<dt>(定义项目/名字)和<dd>(描述每一个项目/名字)一起使用。
自定义列表的基本语法格式如下:
<dl>
<dt>名词1</dt>
<dd>名词1解释1</dd>
<dd>名词1解释2</dd>
<dd>名词1解释3</dd>
...
</dl>
示例:
<dl>
<dt><strong>学校</strong></dt>
<dd>清华大学</dd>
<dd>北京大学</dd>
<dd>东南大学</dd>
</dl>
<!--渲染出来<dt>和<dd>前面会有很大的间隔, 这个是可以修饰的-->
<dl></dl>里面只能包含<dt></dt>和<dd></dl>。<dt></dt>和<dd></dl>个数没有限制,经常是一个对应多个。
边栏推荐
- Comparison of four delivery modes of Message Oriented Middleware
- VIM quickly select a method / function
- How PTP helps several major operators meet 5g timing requirements
- 如何提高回归测试效率
- Build local source 2.0 for Galaxy Kirin server version
- OpenGL Chapter 11 multiple light sources
- Right click PowerShell here function add
- Samsung Galaxy S21 ultra and Apple iPhone 13 Pro Max: which one should you choose
- Unity's data persistence -- Jason
- /The world of 10 recommended websites for learning programming has entered the era of the Internet. According to a recently released Internet trends 2016 report, China has become a leader in the Inter
猜你喜欢

Samsung Galaxy S21 ultra and Apple iPhone 13 Pro Max: which one should you choose

大厂外包or自研公司?测试人找工作怎么选?

Kirin V10 installation of tongweb7.0

Solution to the problem of gd32f4 serial port DMA reception

Typera+picgo+ common configurations of Tencent cloud cos

Maui migration guide

The tide play power is really firepower! The first big screen cinema for young people? Cool open TV Max 86 "sudden attack

手工测试转不了自动化测试,缺的是什么?

基于SSM框架的学生老师考试管理系统

Thinkphp3.2.3 deserialization using chain analysis
随机推荐
Azure kubernates service update | improve development experience and efficiency
Typera+picgo+ common configurations of Tencent cloud cos
MAUI 遷移指南
OpenGL第八章 材质material
基于FPGA的一维卷积神经网络CNN的实现(五)数据量化(附代码)
OpenGL Chapter 10 illuminant
OpenGL Chapter 8 material
OpenGL第七章 基础光照
Docker swarm installing MySQL Cluster
OpenGL error Guide
What kind of people are happy?
JMeter piezometric interface programming North
Xu Li 618, how can Suning fight this hard battle?
BP神经网络C语言实现总结
2_ Introduction to SPU related services
Oppo reno6 turned sour by "inner roll"
Record the problem of Galaxy Kirin V10 server version once: an error is reported when installing KVM
[cnn]| translation invariance
ARM开发板方案与厂商分析
SQL | some indicators of the game industry