新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
CSS學(xué)習(xí)筆記--CSS列表-創(chuàng)新互聯(lián)
不同的列表項(xiàng)標(biāo)記
list-style-type屬性指定列表項(xiàng)標(biāo)記的類型是:

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;}作為列表項(xiàng)標(biāo)記的圖像
要指定列表項(xiàng)標(biāo)記的圖像,使用列表樣式圖像屬性:
ul
{
list-style-image: url('sqpurple.gif');
}上面的例子在所有瀏覽器中顯示并不相同,IE和Opera顯示圖像標(biāo)記比火狐,Chrome和Safari更高一點(diǎn)點(diǎn)。
瀏覽器兼容性解決方案
同樣在所有的瀏覽器,下面的例子會(huì)顯示的圖像標(biāo)記:
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;
}例子解釋:
- ul:
- 設(shè)置列表樣式類型為沒有刪除列表項(xiàng)標(biāo)記
- 設(shè)置填充和邊距0px(瀏覽器兼容性)
- ul中所有l(wèi)i:
- 設(shè)置圖像的URL,并設(shè)置它只顯示一次(無重復(fù))
- 您需要的定位圖像位置(左0px和上下5px)
- 用padding-left屬性把文本置于列表中
列表 -簡(jiǎn)寫屬性
在單個(gè)屬性中可以指定所有的列表屬性。這就是所謂的簡(jiǎn)寫屬性。
為列表使用簡(jiǎn)寫屬性,列表樣式屬性設(shè)置如下:
ul
{
list-style: square url("sqpurple.gif");
}可以按順序設(shè)置如下屬性:
- list-style-type
- list-style-position (有關(guān)說明,請(qǐng)參見下面的CSS屬性表)
- list-style-image
如果上述值丟失一個(gè),其余仍在指定的順序,就沒關(guān)系。
所有不同的CSS列表項(xiàng)標(biāo)記。
ul.a{list-style-type:circle;}
ul.b{list-style-type:disc;}
ul.c{list-style-type:square;}
ol.d{list-style-type:armenian;}
ol.e{list-style-type:cjk-ideographic;}
ol.f{list-style-type:decimal;}
ol.g{list-style-type:decimal-leading-zero;}
ol.h{list-style-type:georgian;}
ol.i{list-style-type:hebrew;}
ol.j{list-style-type:hiragana;}
ol.k{list-style-type:hiragana-iroha;}
ol.l{list-style-type:katakana;}
ol.m{list-style-type:katakana-iroha;}
ol.n{list-style-type:lower-alpha;}
ol.o{list-style-type:lower-greek;}
ol.p{list-style-type:lower-latin;}
ol.q{list-style-type:lower-roman;}
ol.r{list-style-type:upper-alpha;}
ol.s{list-style-type:upper-latin;}
ol.t{list-style-type:upper-roman;}
ol.u{list-style-type:none;}
ol.v{list-style-type:inherit;}


本文標(biāo)題:CSS學(xué)習(xí)筆記--CSS列表-創(chuàng)新互聯(lián)
當(dāng)前URL:http://www.dlmjj.cn/article/dojpsi.html


咨詢
建站咨詢
