emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: Aligning Columns in HTML Export Tables


From: Christian Moe
Subject: Re: [Orgmode] Re: Aligning Columns in HTML Export Tables
Date: Mon, 25 Oct 2010 10:51:18 +0200
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.2.11) Gecko/20101013 Thunderbird/3.1.5

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.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]