[英]custom ul li, align bullet to center (as text)?
我正在嘗試創建一個custum項目列表(ul li)
我有這個:
ul {
list-style: none;
list-style-type: none;
padding: 0px;
margin: 0px;
}
ul li {
background-image: url(img/bullet.png);
background-repeat: no-repeat;
background-position: 0px 5px;
padding-left: 10px;
}
結果文字:
o some text
o some other text
o and again some other text
主文本居中,我也希望項目符號也居中對齊(在文本左側旁邊)。文本對齊無濟於事
這個怎么做?
您可以使用:before
偽元素使用白色項目符號unicode char( \\25e6
)來呈現項目符號,如下所示:
ul li:before {
content:'\25e6';
margin-right:5px;
vertical-align:middle;
font-size:1.5em;
line-height:0;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.