emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* how to specify table width in HTML export
@ 2012-03-20  6:06 Stephen J. Barr
  2012-03-20  6:53 ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen J. Barr @ 2012-03-20  6:06 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

This seems like a simple question but I can't seem to find the answer?
How do I specify the table width for an org-table that I will export
to HTML?

Thanks,
Stephen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to specify table width in HTML export
  2012-03-20  6:06 how to specify table width in HTML export Stephen J. Barr
@ 2012-03-20  6:53 ` Nick Dokos
  2012-03-20  7:16   ` Michael Hannon
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2012-03-20  6:53 UTC (permalink / raw)
  To: Stephen J. Barr; +Cc: nicholas.dokos, emacs-orgmode

Stephen J. Barr <stephenjbarr@gmail.com> wrote:

> Hello,
> 
> This seems like a simple question but I can't seem to find the answer?
> How do I specify the table width for an org-table that I will export
> to HTML?
> 

Not sure about the real HTMl syntax, or whether this is the best
solution (I'd imagine CSS would be better *if* it can be done with CSS)
but the following:

#+ATTR_HTML: width="100"
| col1 | col2 |
|------+------|
|    1 |    3 |
|      |      |

gets translated into an HTML table with an opening tag like this:

<table  border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides" width="100">

Does that do the trick?

Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to specify table width in HTML export
  2012-03-20  6:53 ` Nick Dokos
@ 2012-03-20  7:16   ` Michael Hannon
  2012-03-20 14:42     ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Hannon @ 2012-03-20  7:16 UTC (permalink / raw)
  To: nicholas.dokos@hp.com, Stephen J. Barr; +Cc: emacs-orgmode@gnu.org

> From: Nick Dokos <nicholas.dokos@hp.com>
>
> Stephen J. Barr <stephenjbarr@gmail.com> wrote:
>
>> Hello,
>>
>> This seems like a simple question but I can't seem to find the answer?
>> How do I specify the table width for an org-table that I will export
>> to HTML?
>>
>
> Not sure about the real HTMl syntax, or whether this is the best
> solution (I'd imagine CSS would be better *if* it can be done with CSS)
> but the following:
>
> #+ATTR_HTML: width="100"
> | col1 | col2 |
> |------+------|
> |    1 |    3 |
> |      |      |
>
> gets translated into an HTML table with an opening tag like this:
>
> <table  border="2" cellspacing="0"
> cellpadding="6" rules="groups" frame="hsides"
> width="100">
>
> Does that do the trick?

Indeed, I think CSS would be a better approach.  And of course I don't know
what this particular application is, but it's usually better to specify the
width of objects as a percentage of the overall width.

This is discussed, for instance, at:

    http://www.w3schools.com/css/css_table.asp

Here's a line from one of my old .org files that shows the syntax:

    #+STYLE:    <link rel="stylesheet" type="text/css" href="./junk.css" />

It's also possible to embed the styling information directly in the Org-mode
file, but I find that to be less convenient, as you then have to re-export to
make a change to the style.

Caveat: I haven't done any HTML exporting to speak of lately, certainly none
that has involved CSS, so it may be that the syntax has changed (i.e.,
compared to the above STYLE directive).

-- Mike

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to specify table width in HTML export
  2012-03-20  7:16   ` Michael Hannon
@ 2012-03-20 14:42     ` Nick Dokos
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Dokos @ 2012-03-20 14:42 UTC (permalink / raw)
  To: Michael Hannon; +Cc: Stephen J. Barr, nicholas.dokos, emacs-orgmode@gnu.org

Michael Hannon <jm_hannon@yahoo.com> wrote:

> > From: Nick Dokos <nicholas.dokos@hp.com>
> >
> > Stephen J. Barr <stephenjbarr@gmail.com> wrote:
> >
> >> Hello,
> >>
> >> This seems like a simple question but I can't seem to find the answer?
> >> How do I specify the table width for an org-table that I will export
> >> to HTML?
> >>
> >
> > Not sure about the real HTMl syntax, or whether this is the best
> > solution (I'd imagine CSS would be better *if* it can be done with CSS)
> > but the following:
> >
> > #+ATTR_HTML: width="100"
> > | col1 | col2 |
> > |------+------|
> > |    1 |    3 |
> > |      |      |
> >
> > gets translated into an HTML table with an opening tag like this:
> >
> > <table  border="2" cellspacing="0"
> > cellpadding="6" rules="groups" frame="hsides"
> > width="100">
> >
> > Does that do the trick?
> 
> Indeed, I think CSS would be a better approach.  And of course I don't know
> what this particular application is, but it's usually better to specify the
> width of objects as a percentage of the overall width.
> 

Just to make sure

#+ATTR_HTML: width="50%"

is just the "same" as far as the HTML exporter is concerned: it'll just blindly
tack it to the <table ...> tag.

> This is discussed, for instance, at:
> 
>     http://www.w3schools.com/css/css_table.asp
> 

Nice reference, thanks! Particularly for those (like me) whose CSS fu is
weak to non-existent.

> Here's a line from one of my old .org files that shows the syntax:
> 
>     #+STYLE:    <link rel="stylesheet" type="text/css" href="./junk.css" />
> 
> It's also possible to embed the styling information directly in the Org-mode
> file, but I find that to be less convenient, as you then have to re-export to
> make a change to the style.
> 
> Caveat: I haven't done any HTML exporting to speak of lately, certainly none
> that has involved CSS, so it may be that the syntax has changed (i.e.,
> compared to the above STYLE directive).
> 

I think things have not changed in this area.

Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-20 14:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-20  6:06 how to specify table width in HTML export Stephen J. Barr
2012-03-20  6:53 ` Nick Dokos
2012-03-20  7:16   ` Michael Hannon
2012-03-20 14:42     ` Nick Dokos

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).