1. quick brown fox
<2. jumped over>
<3. the lazy dog>
いくつか<li>
の s を単一<ol>
のスタイルの with::before
および::after
疑似要素 (上記の項目 2 および 3 の < および >) に含めたいと考えています。現在、2 つのリストとして作成しています。<ol>
2 つではなく1 つだけを使用してそれを行う方法を見つけようとしているので、使用する必要がなくなりますcounter-reset
。
.li_var {
counter-reset: lt 1;
}
.li_var > li {
counter-increment: lt;
}
.li_var > li::before {
content: "<" counter(lt);
}
.li_var > li::after {
content: ">";
}
<ol>
<li>quick brown fox</li>
</ol>
<ol class="li_var">
<li>jumped over</li>
<li>the lazy dog</li>
</ol>
私の作業ソリューション:
.li_var {
list-style-type:none;
}
.li_var > li {
counter-increment: lt;
}
.li_var > li:before {
content: counter(lt) '. ';
}
.li_var li:nth-child(2), .li_var li:nth-child(3) {
margin-left:-.6em;
}
.li_var li:nth-child(2):before, .li_var li:nth-child(3):before {
content: '<' counter(lt) '. ';
}
.li_var li:nth-child(2):after, .li_var li:nth-child(3):after {
content:'>';
}