之前有人做过有序列表的CSS hack,我用的就是他的方案,但是我忘了在哪儿看到的了。只能把代码分享一下了,下面CSS放在custom.css
里,用的时候在块上给个 #ol
的tag就可以了。例如:
/* Ordered list */
/* numbered lists 0.3 20210605 */
/* usage : tag parent block with #ol or #.v-ol*/
.ls-block[data-refs-self*="ol"]
> .block-children-container
> .block-children
> .ls-block {
counter-increment: lvlNumber;
}
.ls-block[data-refs-self*="ol"]
> .block-children-container
> .block-children
> .ls-block
> div
> div
> a
> .bullet-container:before {
content: counters(lvlNumber, ".") ".";
position: absolute;
display: block;
}
.ls-block[data-refs-self*="ol"]
> .block-children-container
> .block-children
> .ls-block
> .block-children-container
> .block-children
> .ls-block {
counter-increment: sublvlNumber;
}
.ls-block[data-refs-self*="ol"]
> .block-children-container
> .block-children
> .ls-block
> .block-children-container
> .block-children
> .ls-block
> div
> div
> a
> .bullet-container:before {
content: counters(lvlNumber, ".") "." counters(sublvlNumber, ".") ".";
position: absolute;
max-width: 60px;
padding-right: 0px;
width: 40px;
}
.ls-block[data-refs-self*="ol"]
> .block-children-container
> .block-children
> .ls-block
> .block-children-container
> .block-children
> .ls-block
> div
> div
> .block-control {
width: 30px !important;
margin-left: -0.75em;
}
.ls-block[data-refs-self*="ol"]
> .block-children-container
> .block-children
> .ls-block
> .block-children-container
> .block-children {
padding-left: 0.4em;
}
/* hide bullets */
.ls-block[data-refs-self*="ol"]
> .block-children-container
> .block-children
> .ls-block
> .block-children-container
> .block-children
div
.bullet-container:before {
content: "";
}
.ls-block[data-refs-self*="ol"]
> .block-children-container
> .block-children
> .ls-block
> div
> div
> a
> .bullet-container
> .bullet {
visibility: hidden;
}
.ls-block[data-refs-self*="ol"]
> .block-children-container
> .block-children
> .ls-block
> .block-children-container
> .block-children
> .ls-block
> div
> div
> a
> .bullet-container
> .bullet {
visibility: hidden;
}