epub 格式的字母列表

styled lettered lists in epub

在 epub 中,我想以这种方式设置单个字母列表的样式:

(a) Some text goes here.
(b) More text here.
(c) This line is longer. It goes on and on. And on some more. And then it
    keeps going until it wraps.
(d) Another long line. This one will wrap too, once it gets to be long
    enough. You get the idea. The text should always line up while the
    list letters hang.

以下代码将在每个列表的基础上执行我想要的操作:

ol.alpha_list { 
  counter-reset: item;

}

ol.alpha_list > li {
    list-style: none;
    position: relative;
}

ol.alpha_list li:before {
  counter-increment: item;
  content:"(" counter(item, lower-alpha) ") ";
  position: absolute;
  left: -1.4em;
}

但这在我的 epub 文件中没有正确呈现。结果是这样的:

(a) Some text goes here.
(b) More text here.
(c) This line is longer. It goes on and on. And on some more. And then it
keeps going until it wraps.
(d) Another long line. This one will wrap too, once it gets to be long
enough. You get the idea. The text should always line up while the
list letters hang.

有没有办法让它像第一个例子那样工作?

尝试在 li css 中添加 "list-style-position: outside;" 和 "margin-left: 2em;"。

ol.alpha_list { 
  counter-reset: item;

}

ol.alpha_list > li {
    list-style: none;
    position: relative;
    list-style-position: outside;
    margin-left: 2em;
}

ol.alpha_list li:before {
  counter-increment: item;
  content:"(" counter(item, lower-alpha) ") ";
  position: absolute;
  left: -1.4em;
}