首頁  >  文章  >  web前端  >  CSS:list-style-type的使用方法詳解

CSS:list-style-type的使用方法詳解

黄舟
黄舟原創
2018-05-23 16:03:165909瀏覽

這篇文章主要介紹了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), β(beta), γ(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,中文"類型"的意思.

範例

ul    
{    
    list-style-type:disc;   
}   
ul#circle
{    
    list-style-type:circle;   
}   
ul#square
{    
    list-style-type:square;   
}   
ul#decimal   
{    
    list-style-type:decimal;   
}   
ul#decimal-leading-zero   
{    
    list-style-type:decimal-leading-zero;   
}   
ul#lower-roman   
{    
    list-style-type:lower-roman;   
}   
ul#upper-roman   
{    
    list-style-type:upper-roman;   
}   
ul#lower-greek   
{    
    list-style-type:lower-greek;   
}   
ul#lower-latin   
{    
    list-style-type:lower-latin;   
}   
ul#upper-latin   
{    
    list-style-type:upper-latin;   
}   
ul#armenian   
{    
    list-style-type:armenian;   
}   
ul#georgian   
{    
    list-style-type:georgian;   
}   
ul#lower-alpha   
{    
    list-style-type:lower-alpha;   
}   
ul#upper-alpha   
{    
    list-style-type:upper-alpha;   
}   
ul#none
{    
    list-style-type:none;   
}   
ol    
{    
    list-style-type:lower-roman;   
}

以上是CSS:list-style-type的使用方法詳解的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn