emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Bernt Hansen <bernt@norang.ca>, Jeff Horn <jrhorn424@gmail.com>,
	Org-mode ml <emacs-orgmode@gnu.org>,
	Dan Davison <dandavison7@gmail.com>,
	Baoqiu Cui <cbaoqiu@yahoo.com>
Subject: Re: Re: Aligning Columns in HTML Export Tables
Date: Mon, 25 Oct 2010 15:13:21 +0200	[thread overview]
Message-ID: <4CC58271.6050005@christianmoe.com> (raw)
In-Reply-To: <21BA9B33-4ACD-4B43-9EF8-84765DA7EC2E@gmail.com>

On 10/25/10 11:08 AM, Carsten Dominik wrote:
>
> On Oct 25, 2010, at 10:51 AM, Christian Moe wrote:
>
>> On 10/25/10 6:36 AM, Baoqiu Cui wrote:
>> I am wondering if there
>>> is any special reason to use "class" instead of "align". If not,
>>> can we
>>> change the elisp code to use "align"?
>>
>> I believe the "align" attribute is slated for obsoletion in HTML5,
>> on the grounds that it's better handled by CSS.
>>
>> http://www.w3.org/TR/html5/obsolete.html
>>
>> It's a reason to go with "class" instead. Not a compelling one,
>> perhaps.
>>
>> My only strong opinion on this is that I absolutely agree with the
>> choice not to set the "style" attribute locally on each table cell.
>
> Hmm, butwe do now set the class in each cell. Is that any better?
>
> - Carsten

It's a subtle difference, and every way works, so I don't want to 
waste more of your time.

#+begin_rant
But yes, I think it /is/ better, for the same reason Sebastian 
requested it: Setting class is the preferred way to make all cells of 
that class custom-styleable by changing a single line in the stylesheet.

As I pointed out below, though, it's not the only way. CSS lets you do 
the same, nearly as easily, if "align" is used instead of "class" as 
Baoqiu Cui suggested; "class" is more future-proof (HTML5), "align" 
more compact (the default is already defined).

(Heck, come to think of it, Sebastian could have monospaced the 
left-aligned column in his example even when Org set "style" on each 
cell, using a selector like:
: td[style="text-align: left;"] { font-family: monospace; }
-- but that, I think, would be perverse.)

Over-use of the style attribute to set styles locally works against 
the purpose of CSS. The local style attribute should be used for 
exceptions; general rules should be handled at a higher level of the 
cascade.

Having to set /anything/ on each cell just to align a column is not 
optimal either, but since some browsers don't honor colgroups, it's 
the most robust way.
#+end_rant

Christian

>>
>> But Sebastian Rose's request that prompted it, /could/ equally well
>> be addressed with the "align" attribute:
>>
>>> How about this (line-wrapped for readability):
>>>
>>>
>>> <tr>
>>> <td class="right">1</td>
>>> <td class="left">bar</td>
>>> <td class="left">text</td>
>>> <tr>
>>>
>>> instead of
>>>
>>> <tr>
>>> <td style="text-align:right">1</td>
>>> <td style="text-align:left">bar</td>
>>> <td style="text-align:left">text</td>
>>> <tr>
>>>
>>> ??
>>>
>>>
>>> Combined with the ways to add IDs and classes to tables, we could
>>> then style the
>>> columns better.
>>>
>>> I would like to set this for right aligned <td> tags as default:
>>>
>>> td.right { font-family:monospace;text-align:right; }
>>
>> Using the "align" attribute as follows,
>>
>> <tr>
>> <td align="right">1</td>
>> <td align="left">bar</td>
>> <td align="left">text</td>
>> <tr>
>>
>> Sebastian could achieve the same with CSS like
>>
>> td[align="right"] { font-family: monospace;}
>>
>> In the same way one could even use CSS to override the alignment
>> specified by the "align" attribute, if for whatever reason this
>> seemed like a good idea...
>>
>> One slight advantage of the "align" attribute over "class" is that
>> it doesn't require the default style to contain the extra verbiage
>> Carsten mentioned:
>>
>>> I have now in the default style:
>>>
>>> td, th { vertical-align: top; }
>>> th.right { text-align:right; }
>>> th.left { text-align:left; }
>>> th.center { text-align:center; }
>>> td.right { text-align:right; }
>>> td.left { text-align:left; }
>>> td.center { text-align:center; }
>>>
>>> Is there a way to write this more compactly?
>>
>> Yours,
>> Christian
>
> - Carsten
>
>

  reply	other threads:[~2010-10-25 13:11 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-20 16:42 Aligning Columns in HTML Export Tables Jeff Horn
2010-10-20 17:16 ` Bernt Hansen
2010-10-20 19:04   ` Christian Moe
2010-10-20 20:11     ` Jeff Horn
2010-10-21  0:25   ` Sebastian Rose
2010-10-21  7:36     ` Christian Moe
2010-10-21  7:46       ` Carsten Dominik
2010-10-21 13:04         ` Sebastian Rose
2010-10-21 13:25           ` Sebastian Rose
2010-10-22  7:32   ` Carsten Dominik
2010-10-22 11:20     ` Sebastian Rose
2010-10-22 11:27       ` Carsten Dominik
2010-10-22 13:59         ` Sebastian Rose
2010-10-22 15:41           ` Carsten Dominik
2010-10-22 19:30             ` Sebastian Rose
2010-10-23  5:42               ` Carsten Dominik
2010-10-23 19:03                 ` Sebastian Rose
2010-10-22 19:37             ` Sebastian Rose
2010-10-23  5:53               ` Carsten Dominik
2010-10-23 19:20                 ` Sebastian Rose
2010-10-23 19:28                 ` Sebastian Rose
2010-10-25  6:48                   ` Carsten Dominik
2010-10-25  9:02                     ` Giovanni Ridolfi
2010-10-25  9:09                       ` Carsten Dominik
2010-10-25  4:36     ` Baoqiu Cui
2010-10-25  8:51       ` Christian Moe
2010-10-25  9:08         ` Carsten Dominik
2010-10-25 13:13           ` Christian Moe [this message]
2010-10-25 13:22             ` Carsten Dominik
2010-10-25 14:55               ` Sebastian Rose
2010-10-25 20:41                 ` Christian Moe
2010-10-25 21:52                 ` Baoqiu Cui
2010-10-26  5:11                   ` Carsten Dominik
2010-10-26 16:03                     ` Baoqiu Cui
2010-10-25 13:43             ` Carsten Dominik
2010-10-25 20:04               ` Christian Moe
2010-10-25 21:39                 ` Sebastian Rose
2010-10-26  5:12                   ` Carsten Dominik

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=4CC58271.6050005@christianmoe.com \
    --to=mail@christianmoe.com \
    --cc=bernt@norang.ca \
    --cc=carsten.dominik@gmail.com \
    --cc=cbaoqiu@yahoo.com \
    --cc=dandavison7@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jrhorn424@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).