emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Table column width and HTML export


From: Kaushal Modi
Subject: Re: [O] Table column width and HTML export
Date: Tue, 18 Sep 2018 14:25:01 -0400

On Tue, Sep 18, 2018 at 7:35 AM Martin Dalgaard Villumsen <address@hidden> wrote:
>
> How do you in org-mode override/identify the column-class for a single column when you have multiple columns of the same type in the same table?

As I said, you can do everything using CSS and the existing ox-html version.

Here's an example:

=====
#+title: Specify widths different for different table columns in HTML export
#+author: Kaushal Modi

#+begin_export html
<style>
/* First column */
table.foo td:first-child {
  width: 200px;
}
/* Second column */
table.foo td:nth-child(2) {
  width: auto;
}
/* Last column */
table.foo td:last-child {
  width: 400px;
}
</style>
#+end_export

The column widths in below table will stay at default.

|----------+----------+----------|
| Header 1 | Header 2 | Header 3 |
|----------+----------+----------|
| abc      | def      | ghi      |
| jkl      | mno      | pqr      |
| stu      | vwx      | yz       |
|----------+----------+----------|

Below, the left-most column will be 200px wide and the right-most will
be 400px wide. The center column will stay at default width.

#+attr_html: :class foo
|----------+----------+----------|
| Header 1 | Header 2 | Header 3 |
|----------+----------+----------|
| abc      | def      | ghi      |
| jkl      | mno      | pqr      |
| stu      | vwx      | yz       |
|----------+----------+----------|
* CSS References
- https://stackoverflow.com/a/6254367/1219634
- [[https://www.w3schools.com/cssref/sel_element_pluss.asp][CSS -- /element+element/ selector]]
- [[https://www.w3schools.com/cssref/sel_firstchild.asp][CSS -- ~:first-child~]]
- [[https://www.w3schools.com/cssref/sel_last-child.asp][CSS -- ~:last-child~]]
- [[https://www.w3schools.com/cssref/sel_nth-child.asp][CSS -- ~:nth-child()~]]
- [[https://www.w3schools.com/cssref/sel_nth-last-child.asp][CSS -- ~:nth-last-child()~]]
=====

Screenshot (see below/attached):

image.png

reply via email to

[Prev in Thread] Current Thread [Next in Thread]