0
<ul>
    <li>number</li> 
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
</ul>

そしてスタイルシート:

ul {
    list-style-type: none
}

ul li {
    float: left;
}

li:after {
    content: ", "
}

li:before {
    content: ": "
}

li:last-child:after {
    content: "."
}

li:first-child:before {
    content: ""
}

結果は次のとおりです。

number, 1, 2, 3, 4, 5.

この結果を修正する方法:

number: 1, 2, 3, 4, 5.
4

2 に答える 2

7

これを追加:

li:first-child:after {
    content: ": "
}
于 2013-01-30T08:38:16.570 に答える
0

li:first-child:after {content: ": "}too add : after number line を試してみてください 。またli:not(:first-child):after {content: ", "}、他の行の後にも add します。

完全なソリューション

ul {list-style-type: none}
ul li {float: left;}
li:not(:first-child):after {content: ", "}
li:last-child:after {content: "."}
li:first-child:after {content: ": "}

ダブレットの要点を確認できます:http://dabblet.com/gist/4681763

于 2013-01-31T09:56:15.440 に答える