溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

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

發(fā)布時間:2021-07-29 21:14:32 來源:億速云 閱讀:396 作者:chen 欄目:web開發(fā)

本篇內(nèi)容介紹了“CSS list-style-type屬性的使用方法”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

設(shè)置對象的行項標(biāo)記的預(yù)定義類型。

語法
{ list-style-type: sType }

可能的值
sType

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

disc

默認(rèn)值。實心圓。

circle

空心圓。

decimal

1、2、3、4 等等。

lower-alpha

a、b、c、d 等等。

lower-roman

i、ii、iii、iv 等等。

none

不顯示任何標(biāo)記。

square

實心正方形。

upper-alpha

A、B、C、D 等等。

upper-roman

I、II、III、IV 等等。

該屬性的默認(rèn)值為 disc 。該屬性會被繼承。

注解

如果 list-style-image 屬性的值設(shè)置為 none ,或者無法顯示 URL 指向的圖像,則 list-style-type 屬性決定 list-item 標(biāo)記的外觀。

list-style-type 屬性可在應(yīng)用 margin 和 display:list-item 屬性之后應(yīng)用于任何元素。

如果使用其中一個 margin 屬性將行項的左邊距設(shè)置為 0,則不會顯示列表項標(biāo)記。該邊距至少應(yīng)設(shè)置為 30 磅。

示例
下面的示例使用 list-style-type 屬性設(shè)置標(biāo)記。本示例在內(nèi)嵌(全局)樣式表中使用 UL 元素作為選擇器,以將標(biāo)記類型更改為 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: 數(shù)字
decimal-leading-zero: 十進(jìn)制數(shù),不足兩位的補齊前導(dǎo)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: 亞美尼亞數(shù)字
georgian: 喬治亞數(shù)字,例如: 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復(fù)制內(nèi)容到剪貼板

  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屬性的使用方法”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

css
AI