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: Sebastian Rose
Subject: Re: [Orgmode] Re: Aligning Columns in HTML Export Tables
Date: Mon, 25 Oct 2010 23:39:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Christian Moe <address@hidden> writes:
> Maybe someone with a browser where colgroups actually do work (Opera!) can 
> check
>
> 1. if they only work with the align attribute, and not with CSS, and
>
> 2. whether they still work (take precedence) now that the individual cells are
> aligned with CSS for their class.

They _never_ took precedence, as soon as I used a style like this:

  /* My default for all td elements */
  td { text-align:left; }

The `td' style will alway be a "better" CSS-match than the col's style
or class attribute, even then the col's align attribute.  It's even the
expected behaviour according to CSS standards since that what's the `C'
in CSS means.  I have to remove my favourite default style for td
elements from my stylesheet to make that work in Opera, too.  In current
FF it does not work at all.

Here's another test:

CSS:
--8<---------------cut here---------------start------------->8---
  col.right  { text-align:right;vertical-align:top;background-color:red; }
  col.left   { text-align:left;vertical-align:top;background-color:green; }
  col.center { text-align:center;vertical-align:top;background-color:blue; }
--8<---------------cut here---------------end--------------->8---



A table:

--8<---------------cut here---------------start------------->8---
<table  border="0" summary="">
<caption></caption>
<colgroup><col class="left" /><col class="center" /><col class="right" />
</colgroup>
<thead>
<tr><th>A</th><th>B</th><th>C</th></tr>
</thead>
<tbody>
<tr><td>1</td><td >bar</td><td>text</td></tr>
<tr><td>12</td><td >test</td><td>300</td></tr>
<tr><td>9</td><td >foo</td><td>4</td></tr>
</tbody>
</table>
--8<---------------cut here---------------end--------------->8---


The only `style' that works that way is the `background-color'.  In
Opera and FF at least.

Means, the `class' attribute in <col> elements doesn't work very well
(but '<col class="odd" /><col class="even" />' might make sense with
alternating colors)..

Both, 'align' and the 'style' attribute will be overwritten by a default
style for a <td> element in the users stylesheet (some prefere center,
some left alignment as the default).



It's common practice to have `style' or `class' attribute in td
elements.  That's what classes are for in the end.  Make HTML elements
members of a group with certain properties.

Why not jut go with it?


Look at `magento's code, Drupal, whatever.  They even use more those
usefull classes, e.g. `first' and `last' for the first and last elements
of lists.  HTML elements without classes are hard to find.  The reason
is, that HTML is just a document structure.  Classes (and IDs) make
those elements live.

"first" "last" "right" "left" "content" "footnote" "menu" "comment"
"big" "small" "light" "dark" "pro" "contra" - classes make the
difference.

Plus 'class="right"' is easy to change in central place left
entrirely to the user:  the stylesheet.

XML is not meant to avoid clutter.  And if it was, something went
terribly wrong, I guess :)



  Sebastian



reply via email to

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