[Bug 15100] Right-aligning a numeric table column is much more work than it should be

https://www.w3.org/Bugs/Public/show_bug.cgi?id=15100

Ian 'Hixie' Hickson <ian@hixie.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX

--- Comment #15 from Ian 'Hixie' Hickson <ian@hixie.ch> 2012-01-28 18:07:00 UTC ---
(In reply to comment #14)
> 
> I've attached the original (more complex) alignment challenge.

If you just want the last two columns right-aligned, the CSS I gave above would
still work, even with the rowspans in that example. I agree that it's
theoretically possible that there be tables where you'd need something more
complicated where if you could just style columns directly it would be more
convenient, but my overall point is that the cases where simple CSS can't
handle it are far and few between, rare enough that it doesn't make sense to
optimise the language for those cases.


> The proposed future CSS selector :nth-col() could simplify this for situations
> where CSS selectors may be applied

Indeed. It could also be extended to support classes or other selectors, as in:

   col.numeric // td { text-align: right }

I recommend contacting the CSS WG if that's something that is of interest. (The
'//' combinator has in the past been proposed for "has a semantic relationship
to".)


> but there isn't really a way to add that to
> a forum post or a wiki or other user-contibuted content (or CMS body content)
> that only allows markup, so that reduces it's viability.

In such a context you can just define a class value for the styles you want and
let users use that. This is the same as how HTML doesn't offer a way to change
the colour of text, even though sometimes the preferred way to indicate a
particular semantic is colour.


> > To get that effect would need classes on each cell; a <col> attribute wouldn't work.
> 
> That depends on the browser

I was specifically talking about the case where you wanted the numbers
right-aligned but not the dates. <col> can't even do that theoretically.


> Since we are already decorating each cell, why not provide a semantic element
> that at least provides a hint to the renderer as to the fundamental type of the
> data. A semantic element would be far more concise (<tn> rather than <td
> class=n>), and wouldn't require an external style rule to work.

There's a number of ways of doing this within a site (e.g. class values, data-*
attributes, the <data> and <time> elements); if this is something that gets a
lot of adoption, it would make sense to provide a more formal solution. But in
practice I haven't seen this kind of thing much. More objective research would
be useful.


EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
satisfied with this response, please change the state of this bug to CLOSED. If
you have additional information and would like the editor to reconsider, please
reopen this bug. If you would like to escalate the issue to the full HTML
Working Group, please add the TrackerRequest keyword to this bug, and suggest
title and text for the tracker issue; or you may create a tracker issue
yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: no spec change
Rationale: The provided examples can be handled easily with CSS. Adding a
feature to HTML to do this would be non-trivial and isn't justified by its
cost-benefit ratio.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Saturday, 28 January 2012 18:07:06 UTC