温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

CSS list-style-type属性的使用方法

发布时间:2021-07-29 21:14:32 来源:亿速云 阅读:391 作者:chen 栏目:web开发

本篇内容介绍了“CSS list-style-type属性的使用方法”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

设置对象的行项标记的预定义类型。

语法
{ list-style-type: sType }

可能的值
sType

一个字符串,用于指定以下值之一:

disc

默认值。实心圆。

circle

空心圆。

decimal

1、2、3、4 等等。

lower-alpha

a、b、c、d 等等。

lower-roman

i、ii、iii、iv 等等。

none

不显示任何标记。

square

实心正方形。

upper-alpha

A、B、C、D 等等。

upper-roman

I、II、III、IV 等等。

该属性的默认值为 disc 。该属性会被继承。

注解

如果 list-style-image 属性的值设置为 none ,或者无法显示 URL 指向的图像,则 list-style-type 属性决定 list-item 标记的外观。

list-style-type 属性可在应用 margin 和 display:list-item 属性之后应用于任何元素。

如果使用其中一个 margin 属性将行项的左边距设置为 0,则不会显示列表项标记。该边距至少应设置为 30 磅。

示例
下面的示例使用 list-style-type 属性设置标记。本示例在内嵌(全局)样式表中使用 UL 元素作为选择器,以将标记类型更改为 circle :


代码如下:


<style>
ul {list-style-type:circle}
</style>



list-style-type -- 定义列表样式

取值:disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit
disc: 点
circle: 圆圈
square: 正方形
decimal: 数字
decimal-leading-zero: 十进制数,不足两位的补齐前导0,例如: 01, 02, 03, ..., 98, 99
lower-roman: 小写罗马文字,例如: i, ii, iii, iv, v, ...
upper-roman: 大写罗马文字,例如: I, II, III, IV, V, ...
lower-greek: 小写希腊字母,例如: &alpha;(alpha), &beta;(beta), &gamma;(gamma), ...
lower-latin: 小写拉丁文,例如: a, b, c, ... z
upper-latin: 大写拉丁文,例如: A, B, C, ... Z
armenian: 亚美尼亚数字
georgian: 乔治亚数字,例如: an, ban, gan, ..., he, tan, in, in-an, ...
lower-alpha: 小写拉丁文,例如: a, b, c, ... z
upper-alpha: 大写拉丁文,例如: A, B, C, ... Z
none: 无(取消所有的list样式)
inherit:继承

初始值: disc
继承性: 是
适用于: 所有属于list的元素
list,中文"列表"的意思.style,中文"样式"的意思.type,中文"类型"的意思.

示例

CSS Code复制内容到剪贴板

  1. ul    

  2. {    

  3.     list-style-type:disc;   

  4. }   

  5.   

  6. ul#circle  

  7. {    

  8.     list-style-type:circle;   

  9. }   

  10.   

  11. ul#square  

  12. {    

  13.     list-style-type:square;   

  14. }   

  15.   

  16. ul#decimal   

  17. {    

  18.     list-style-type:decimal;   

  19. }   

  20.   

  21. ul#decimal-leading-zero   

  22. {    

  23.     list-style-type:decimal-leading-zero;   

  24. }   

  25.   

  26. ul#lower-roman   

  27. {    

  28.     list-style-type:lower-roman;   

  29. }   

  30.   

  31. ul#upper-roman   

  32. {    

  33.     list-style-type:upper-roman;   

  34. }   

  35.   

  36. ul#lower-greek   

  37. {    

  38.     list-style-type:lower-greek;   

  39. }   

  40.   

  41. ul#lower-latin   

  42. {    

  43.     list-style-type:lower-latin;   

  44. }   

  45.   

  46. ul#upper-latin   

  47. {    

  48.     list-style-type:upper-latin;   

  49. }   

  50.   

  51. ul#armenian   

  52. {    

  53.     list-style-type:armenian;   

  54. }   

  55.   

  56. ul#georgian   

  57. {    

  58.     list-style-type:georgian;   

  59. }   

  60.   

  61. ul#lower-alpha   

  62. {    

  63.     list-style-type:lower-alpha;   

  64. }   

  65.   

  66. ul#upper-alpha   

  67. {    

  68.     list-style-type:upper-alpha;   

  69. }   

  70.   

  71. ul#none  

  72. {    

  73.     list-style-type:none;   

  74. }   

  75.   

  76. ol    

  77. {    

  78.     list-style-type:lower-roman;   

  79. }   

“CSS list-style-type属性的使用方法”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

css
AI