I am not interested in editing the exported HTML file (conflicts the point of using org-mode)

 

I can add a class to the <table> tag with

 

#+ATTR_HTML: :class my-table

 

But I don’t know how to add a new class to <col> in org-mode; or how to define a custom column (one that is now <r>, <l>, <c>).

 

No point in CSS-restyling default class="org-center", class="org-left", etc.  … this would affect columns in other tables

 

 

/Martin

 

From: Kaushal Modi [mailto:kaushal.modi@gmail.com]
Sent: 18. september 2018 12:31
To: Martin Dalgaard Villumsen <mvillumsen@health.sdu.dk>
Cc: Emacs-orgmode@gnu.org
Subject: Re: [O] Table column width and HTML export

 

On Tue, Sep 18, 2018, 3:38 AM Martin Dalgaard Villumsen <mvillumsen@health.sdu.dk> wrote:

How do I control the column width when exporting a table to HTML?

 

I know how to control the width of the table, but not the width of its columns. For example, I want the width of column A to be 2 cm and the width of B to be 4 cm:

 

|  A |  B |

|----+----|

| 11 | 12 |

| 21 | 22 |

 

Relative settings are also appreciated, A 33% and B 67% of total table width.

Hello,

 

This needs to be solved using CSS. See an example here: https://stackoverflow.com/questions/6253963/table-with-table-layout-fixed-and-how-to-make-one-column-wider

 

In that two solutions are suggested in the selected answer. You should be able to implement the first way using the "td+td" CSS rule. 

 

For the second way using the "col" tag, I don't have the computer accessible right now, to check if ox-html can insert that tag. Even if it did add that tag, you would need to specify the class string for each column, and then use CSS to set the width of each column class. 

 

Right now, the first method seems to be the best?/fastest/easiest way forward.