我想指定从 emacs Org-mode 文件导出到 html 的表中每列的宽度。
实现此目的的特定方法是为每个 th
添加一个类属性。生成的 html 中的标签。然后在我的 css 文件中按类指定列格式。参见例如,
https://css-tricks.com/fixing-tables-long-strings/
如何从 emacs 组织模式生成类属性?
最佳答案
我不知道直接在标题中添加属性的方法,但可以使用 :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 |
关于html - 从 org 导出到 html 时,如何将类属性添加到表头?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49903845/