【问题标题】:styled lettered lists in epubepub中的样式字母列表
【发布时间】:2016-03-28 23:33:06
【问题描述】:

在 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.

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

【问题讨论】:

    标签: html css epub


    【解决方案1】:

    尝试添加“列表样式位置:外部;”和“左边距:2em;”在 li css 中。

    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;
    }
    

    【讨论】:

    • 感谢您的尝试,但没有成功。我正在用 Calibre 编辑这本书,它可以正确呈现(我的原始 CSS 也是如此),但它在我的 iPhone 上的 Marvin 中无法正确呈现。不过,iBooks 似乎可以工作,这很奇怪,因为我认为 iBooks 和 Marvin 会使用相同的 HTML 渲染器。
    • 哎呀! Marvin 有一个设置为“切换到发布者的格式”,这就成功了。当我这样做时,它现在在 Marvin 中正确呈现。再次感谢!
    猜你喜欢
    • 2011-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-09
    • 1970-01-01
    • 1970-01-01
    • 2012-05-11
    相关资源
    最近更新 更多