From: Kaushal Modi <kaushal.modi@gmail.com>
To: Martin Dalgaard Villumsen <mvillumsen@health.sdu.dk>
Cc: emacs-org list <Emacs-orgmode@gnu.org>
Subject: Re: Table column width and HTML export
Date: Tue, 18 Sep 2018 14:25:01 -0400 [thread overview]
Message-ID: <CAFyQvY0JYsKVcTxHSJy2jcFjXXpA4a5oo5Wt__obq=M-UDuLUQ@mail.gmail.com> (raw)
In-Reply-To: <3d8077447aa142bb8ba6817b7849f605@health.sdu.dk>
[-- Attachment #1.1: Type: text/plain, Size: 1944 bytes --]
On Tue, Sep 18, 2018 at 7:35 AM Martin Dalgaard Villumsen <
mvillumsen@health.sdu.dk> 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: image.png]
[-- Attachment #1.2: Type: text/html, Size: 2786 bytes --]
[-- Attachment #2: image.png --]
[-- Type: image/png, Size: 57806 bytes --]
next prev parent reply other threads:[~2018-09-18 18:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 11:34 Table column width and HTML export Martin Dalgaard Villumsen
2018-09-18 18:25 ` Kaushal Modi [this message]
2018-09-19 14:25 ` Martin Dalgaard Villumsen
-- strict thread matches above, loose matches on Subject: below --
2018-09-18 7:37 Martin Dalgaard Villumsen
2018-09-18 7:55 ` Eric S Fraga
2018-09-18 10:31 ` Kaushal Modi
2018-09-18 10:51 ` Martin Dalgaard Villumsen
2018-09-18 11:26 ` Kaushal Modi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFyQvY0JYsKVcTxHSJy2jcFjXXpA4a5oo5Wt__obq=M-UDuLUQ@mail.gmail.com' \
--to=kaushal.modi@gmail.com \
--cc=Emacs-orgmode@gnu.org \
--cc=mvillumsen@health.sdu.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).