【发布时间】:2018-04-18 15:43:08
【问题描述】:
我想指定从 emacs Org-mode 文件导出到 html 的表中每一列的宽度。
实现这一点的具体方法是在生成的 html 中为每个 th 标签添加一个类属性。然后在我的 css 文件中按类指定列格式。参见例如,
https://css-tricks.com/fixing-tables-long-strings/
如何从 emacs Org-mode 生成类属性?
【问题讨论】:
我想指定从 emacs Org-mode 文件导出到 html 的表中每一列的宽度。
实现这一点的具体方法是在生成的 html 中为每个 th 标签添加一个类属性。然后在我的 css 文件中按类指定列格式。参见例如,
https://css-tricks.com/fixing-tables-long-strings/
如何从 emacs Org-mode 生成类属性?
【问题讨论】:
我不知道直接在标题中添加属性的方法,但可以使用:nth-of-type(n) 选择器来设置它们的样式。
#+OPTIONS: num:nil toc:nil html-postamble:nil ^:nil
#+HTML_HEAD: <style type="text/css">
#+HTML_HEAD: .styledtable { width: 400px;}
#+HTML_HEAD: .styledtable col:nth-of-type(1) { width: 25%; background: yellow; }
#+HTML_HEAD: .styledtable col:nth-of-type(2) { width: 50%; background: magenta; }
#+HTML_HEAD: .styledtable col:nth-of-type(3) { width: 25%; background: cyan; }
#+HTML_HEAD: </style>
#+ATTR_HTML: :class styledtable
| column1 | column2 | column3 |
|---------+-------------+---------------------|
| small | medium text | very very long text |
【讨论】: