CSS列表屬性做用以下:css
在HTML中,有兩種類型的列表:瀏覽器
使用CSS,能夠列出進一步的樣式,並可用圖像做列表項標記。url
list-style-type屬性指定列表項標記的類型是:spa
ul.a {list-style-type: circle;} ul.b {list-style-type: square;} ol.c {list-style-type: upper-roman;} ol.d {list-style-type: lower-alpha;}
要指定列表項標記的圖像,使用列表樣式圖像屬性:code
ul { list-style-image: url('sqpurple.gif'); }
上面的例子在全部瀏覽器中顯示並不相同,IE和Opera顯示圖像標記比火狐,Chrome和Safari更高一點點。blog
若是你想在全部的瀏覽器放置一樣的形象標誌,就應使用瀏覽器兼容性解決方案,過程以下ci
一樣在全部的瀏覽器,下面的例子會顯示的圖像標記:it
ul{ list-style-type: none; padding: 0px; margin: 0px; } ul li{ background-image: url(sqpurple.gif); background-repeat: no-repeat; background-position: 0px 5px; padding-left: 14px; }
例子解釋:io
在單個屬性中能夠指定全部的列表屬性。這就是所謂的簡寫屬性。table
爲列表使用簡寫屬性,列表樣式屬性設置以下:
ul { list-style: square url("sqpurple.gif"); }
能夠按順序設置以下屬性:
若是上述值丟失一個,其他仍在指定的順序,就不要緊。
屬性 | 描述 |
list-style | 簡寫屬性,用於把全部列表的屬性設置於一個聲明中 |
list-style-image | 將圖像設置爲列表項標誌 |
list-style-position | 設置列表中列表項標誌的位置 |
list-style-type | 設置列表項標誌的類型 |