代码之家  ›  专栏  ›  技术社区  ›  Raf

emacs org export html:自定义段落与列表页边距

  •  0
  • Raf  · 技术社区  · 6 年前

    跟随 this 简单的解决方案,我用过 margin-left margin-right 要使导出的HTML页面以更易于阅读的格式显示,两边都有较大的边距:

    #+HTML_HEAD_EXTRA: <style>*{margin-left: 2em}*{margin-right: 2em}</style>
    

    所以页面看起来像:

            This is a very long sentence as an 
            example of reading friendly large
            margins in the exported HTML document
            of my org file.
    

    而不是:

    This is a very long sentence as an example of not-reading friendly small margins
    in the exported HTML document of my org file.
    

    段落看起来确实更好。然而,现在的问题是利润率的增加会影响TOC和正文中的所有列表项。比如:

    - List item 1
              - Subitem 1.1
              - Subitem 1.2
                       - Subsubitem 1.2.1
    - List Item 2
              - Subitem 2.1
              - Subitem 2.2
    

    我更愿意看到:

    - List item 1
      - Subitem 1.1
      - Subitem 1.2
        - Subsubitem 1.2.1
    - List Item 2
      - Subitem 2.1
      - Subitem 2.2
    

    现在,是否可以只为文本段落设置自定义边距,而不影响列表?有什么好方法可以做到?

    1 回复  |  直到 6 年前
        1
  •  2
  •   NickD    6 年前

    您可以使用下面的CSS

    #+HTML_HEAD_EXTRA:<style> *{margin-left: 2em;margin-right: 2em}    ul, ol, li, a {margin: 0;} </style>
    

    #+HTML_HEAD_EXTRA:<style> p{margin-left: 2em;margin-right: 2em} </style>