html中list- type
时间: 2023-05-24 19:04:55 浏览: 338
属性定义列表标记的形式。
list-type属性可设置为以下值:
- alpha:小写字母
- uppercase-alpha:大写字母
- decimal:数字
- decimal-leading-zero:前导零的数字
- lower-roman:罗马数字小写
- upper-roman:罗马数字大写
- none:无序列表
示例:
```html
<ol type="alpha">
<li>苹果</li>
<li>香蕉</li>
<li>橙子</li>
</ol>
```
输出:
a. 苹果
b. 香蕉
c. 橙子
```html
<ol type="decimal">
<li>苹果</li>
<li>香蕉</li>
<li>橙子</li>
</ol>
```
输出:
1. 苹果
2. 香蕉
3. 橙子
```html
<ul type="square">
<li>苹果</li>
<li>香蕉</li>
<li>橙子</li>
</ul>
```
输出:
▪ 苹果
▪ 香蕉
▪ 橙子
相关问题
还原ol list-style-type
如果你想将一个有序列表(ol)还原成默认的样式,可以在 CSS 中使用以下代码:
```css
ol {
list-style-type: decimal;
}
```
其中,`decimal` 表示数字形式的有序列表。如果你想还原为无序列表的样式,可以将 `list-style-type` 设置为 `disc`。
如果你只想针对某一个具体的有序列表,可以给这个列表添加一个类名或 ID,并在 CSS 中使用对应的选择器。例如:
```html
<ol class="my-list">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
```
```css
.my-list {
list-style-type: decimal;
}
```
ul的list-style-type不生效
```html
<ul style="list-style-type: none;">
<li>list-style-type属性</li>
<li>list-style-position属性</li>
<li>list-style-image属性</li>
</ul>
```
```html
<ul>
<li style="list-style-type: none;">list-style-type属性</li>
<li style="list-style-type: none;">list-style-position属性</li>
<li style="list-style-type: none;">list-style-image属性</li>
</ul>
```