html - 从 org 导出到 html 时,如何将类属性添加到表头?

标签 html emacs org-mode

我想指定从 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/

相关文章:

url - 如何在 Emacs 缓冲区中同时打开多个 URL?

javascript - 为什么这个 Javascript 函数不显示 alert()?

javascript - 使用 jQuery 验证插件选择2自定义错误消息

java - 如何让我的 Java 代码在连接后显示结果?

emacs - 在字符模式下从 ansi-term 运行 Emacs 命令

emacs - 弹丸搜索只是项目的一部分

带有等号的组织模式内联代码

javascript - 尝试使用下划线解析 JSON(Chrome 上的意外标记)

emacs - 是否有 emacs lisp splat 运算符或其他执行此类操作的方法?

emacs - 将评论导出为评论