html - emacs org 导出 HTML:自定义段落与列表边距
问题描述
遵循这个简单的解决方案,我使用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
现在,是否可以只为文本段落设置自定义边距,而不影响列表?什么是一个巧妙的方法呢?
解决方案
你可以使用下面的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>
推荐阅读
- python - 递归函数修改全局变量未声明为全局
- javascript - 如何(轻松)将 python 变量从 Django 放入 html?
- javascript - 如何编写一个循环生成器,它从消息数组中随机选择项目,但在每个项目都显示一次之前不重复单个项目?
- telerik - Telerik RadDateTimePicker 不允许选择 PM 时间
- git - 如何从某个提交复制 Git 存储库?
- common-lisp - Common Lisp:为什么 delete-if if 与 remove-if 结合 setf 有很大不同?
- mysql - 无法使用 docker 连接到数据库
- google-cloud-platform - gcp terraform 仅为发布/订阅主题上的特定角色分配发布角色
- javascript - 逻辑无效赋值。意外的令牌'??='
- qt - 如何通过 USB 串行端口读取传感器