CSS list-style屬性控制li標籤樣式

list_style屬性用於修改列表的屬性

格式如下:

list_style:列表項標記類型 列表項標記的位置 列表項標記;

也可以單獨設置列表項標記:

list-style-type用於設置列表項類型:

默認值爲disc爲實心圓,

常用值:none空

circle空心圓

square實心方塊

decimal數字

lower-latin小寫拉丁字母a,b,c.....

upper-latin大寫字母A,B,C....

list-style-position用於設這列表項位置:

默認值outside表示在li標籤外部,這是對li添加邊框border:1px solid red;可以看到標記的位置。

inside表示標記在li標籤裏面,同樣添加邊框時可以清晰地看到。

list-style-image用於設置使用圖像替換列表項標記:

默認值:none

可選值:URL ,格式爲url("url地址");

舉例:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style type="text/css">
ul {
border:1px solid red;
}
li{
border:1px solid red;
list-style:disc  outside url(news_list.gif);
list-style-position:5px;
}
</style>
</head>
<ul>
    <li>你好</li>
        <li>我好</li>
    </ul>
<body>
</body>
</html>

規定一個 "list-style-type" 屬性以防圖像不可用。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章