From: Martin Dalgaard Villumsen <mvillumsen@health.sdu.dk>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: emacs-org list <Emacs-orgmode@gnu.org>
Subject: Re: Table column width and HTML export
Date: Wed, 19 Sep 2018 14:25:14 +0000 [thread overview]
Message-ID: <413c6c44fdd14bac8fd1f4bece028e3d@health.sdu.dk> (raw)
In-Reply-To: <CAFyQvY0JYsKVcTxHSJy2jcFjXXpA4a5oo5Wt__obq=M-UDuLUQ@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2621 bytes --]
Thanks for sharing
/Martin
From: Kaushal Modi [mailto:kaushal.modi@gmail.com]
Sent: 18. september 2018 20:25
To: Martin Dalgaard Villumsen <mvillumsen@health.sdu.dk>
Cc: emacs-org list <Emacs-orgmode@gnu.org>
Subject: Re: [O] Table column width and HTML export
On Tue, Sep 18, 2018 at 7:35 AM Martin Dalgaard Villumsen <mvillumsen@health.sdu.dk<mailto: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<https://www.w3schools.com/cssref/sel_element_pluss.asp%5d%5bCSS> -- /element+element/ selector]]
- [[https://www.w3schools.com/cssref/sel_firstchild.asp][CSS<https://www.w3schools.com/cssref/sel_firstchild.asp%5d%5bCSS> -- ~:first-child~]]
- [[https://www.w3schools.com/cssref/sel_last-child.asp][CSS<https://www.w3schools.com/cssref/sel_last-child.asp%5d%5bCSS> -- ~:last-child~]]
- [[https://www.w3schools.com/cssref/sel_nth-child.asp][CSS<https://www.w3schools.com/cssref/sel_nth-child.asp%5d%5bCSS> -- ~:nth-child()~]]
- [[https://www.w3schools.com/cssref/sel_nth-last-child.asp][CSS<https://www.w3schools.com/cssref/sel_nth-last-child.asp%5d%5bCSS> -- ~:nth-last-child()~]]
=====
Screenshot (see below/attached):
[image.png]
[-- Attachment #1.2: Type: text/html, Size: 6258 bytes --]
[-- Attachment #2: image001.jpg --]
[-- Type: image/jpeg, Size: 8640 bytes --]
next prev parent reply other threads:[~2018-09-19 14: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
2018-09-19 14:25 ` Martin Dalgaard Villumsen [this message]
-- 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=413c6c44fdd14bac8fd1f4bece028e3d@health.sdu.dk \
--to=mvillumsen@health.sdu.dk \
--cc=Emacs-orgmode@gnu.org \
--cc=kaushal.modi@gmail.com \
/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).