<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>15100</bug_id>
          
          <creation_ts>2011-12-07 16:11:05 +0000</creation_ts>
          <short_desc>Right-aligning a numeric table column is much more work than it should be</short_desc>
          <delta_ts>2013-02-06 23:57:31 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#top</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Edward O&apos;Connor">eoconnor</assigned_to>
          <cc>brian</cc>
    
    <cc>davidc</cc>
    
    <cc>eoconnor</cc>
    
    <cc>ian</cc>
    
    <cc>jackalmage</cc>
    
    <cc>mike</cc>
    
    <cc>plh</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>robin</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>61093</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-12-07 16:11:05 +0000</bug_when>
    <thetext>Specification: http://www.w3.org/TR/html5/
Multipage: http://www.whatwg.org/C#top
Complete: http://www.whatwg.org/c#top

Comment:
§ 4.9

Today, right-aligning a numeric table column is much more work than it should
be.

Most browsers honor the alignment specified for the col element, but Mozilla
seems to have drawn a line in the sand, claiming the HTML standard and the CSS
standard conflict, leaving bug 915 unfixed for 13 years (and presumably
forever).

This means the best we can currently do, cross-browser, is to add a class to
every numeric td element (in environments where the CSS is modifiable) or add
alignment styling to each numeric td element, crazily bloating the size of
large tables either way.

One possible solution to the problem could just be the introduction of a tn
(table numeric datum) element, with the expectation that the content be
right-aligned. This makes cross-browser tables with a great deal of numeric
data much smaller, and has the potential of allowing Mozilla &amp; lightweight &amp;
mobile browsers (that have trouble rendering cells that inherit style from two
parents) a simpler way to display tables using pure markup.

Posted from: 216.229.170.227
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61094</commentid>
    <comment_count>1</comment_count>
    <who name="Brian Lalonde">brian</who>
    <bug_when>2011-12-07 16:15:01 +0000</bug_when>
    <thetext>(I am the original reporter.)

To clarify, bug 915 in a Mozilla bug number: https://bugzilla.mozilla.org/show_bug.cgi?id=915</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61148</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-12-07 23:02:30 +0000</bug_when>
    <thetext>Right-aligning a numeric column is easy — typically one line of CSS. Do you have a concrete example of a Web page with a numeric column so I can show that it is easy?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61157</commentid>
    <comment_count>3</comment_count>
    <who name="Brian Lalonde">brian</who>
    <bug_when>2011-12-07 23:07:48 +0000</bug_when>
    <thetext>OK, try this one: http://webcoder.info/test/sqldata.html

Can you show me how to accomplish this in a cross-browser way?

The col element won&apos;t work in Mozilla.

The :nth-child pseudo-selector won&apos;t work because of the rowspans.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61221</commentid>
    <comment_count>4</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2011-12-08 09:04:10 +0000</bug_when>
    <thetext>This behavior is a consequence of the CSS table model: http://www.w3.org/TR/CSS2/tables.html#columns

I have no idea where you got your information that &quot;most&quot; browsers honor text-align on columns - *no* current browser does, to the best of my knowledge.  I believe the last browser that did was IE6, because its table model wasn&apos;t based on CSS.

The problem that you cite is being solved in Selectors 4 with the :col() and :nth-col() pseudoclasses: http://dev.w3.org/csswg/selectors4/#table-pseudos

Thus, there is nothing for HTML to do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61222</commentid>
    <comment_count>5</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2011-12-08 09:14:16 +0000</bug_when>
    <thetext>without commenting on how col alignments should work, I&apos;d note that html5 already introduces another markup suitable for highly numeric tables, namely

&lt;math&gt;&lt;mtable&gt;....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61243</commentid>
    <comment_count>6</comment_count>
    <who name="Brian Lalonde">brian</who>
    <bug_when>2011-12-08 16:12:28 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; I have no idea where you got your information that &quot;most&quot; browsers honor
&gt; text-align on columns - *no* current browser does, to the best of my knowledge.
&gt;  I believe the last browser that did was IE6, because its table model wasn&apos;t
&gt; based on CSS.

I stand corrected (I thought WebKit did this as well), but we&apos;re both a bit wrong on this point. Current Opera, and IE (at least through version 8) both support the align attribute on the col element (IE also honors the text-alignment of the col element for the cells in that column).

&gt; The problem that you cite is being solved in Selectors 4 with the :col() and
&gt; :nth-col() pseudoclasses: http://dev.w3.org/csswg/selectors4/#table-pseudos

I hadn&apos;t seen that yet. That, if supported, should be a big help in a few years.

&gt; Thus, there is nothing for HTML to do.

The CSS selector approach works well enough when new style rules can be injected into content. For bug comments or forums or other environments that may not allow new styles, a markup solution that provided a semantic clue of a column&apos;s broad data type would still be more practical.

(In reply to comment #5)
That seems a bit like an abuse of MathML that may not be terribly reliable, though I could be wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61245</commentid>
    <comment_count>7</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2011-12-08 16:20:31 +0000</bug_when>
    <thetext>&gt; That seems a bit like an abuse of MathML

Not sure why you&apos;d consider that abuse. Putting numeric data, including numeric tables, into web pages is its main reason for existing. I edit that spec and I wouldn&apos;t feel abused if you used it that way:-)

&gt; that may not be terribly reliable

If you mean that it may not be implemented everywhere, that&apos;s true but its implementation status is known/detectable and any new markup has a greater problem that it isn&apos;t implemented anywhere.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61246</commentid>
    <comment_count>8</comment_count>
      <attachid>1050</attachid>
    <who name="Brian Lalonde">brian</who>
    <bug_when>2011-12-08 16:53:21 +0000</bug_when>
    <thetext>Created attachment 1050
Column alignment test/example</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61248</commentid>
    <comment_count>9</comment_count>
    <who name="Brian Lalonde">brian</who>
    <bug_when>2011-12-08 16:54:40 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; If you mean that it may not be implemented everywhere, that&apos;s true but its
&gt; implementation status is known/detectable and any new markup has a greater
&gt; problem that it isn&apos;t implemented anywhere.

Fair point. However, if I&apos;m going to display a list of financial transactions, it seems reasonable to provide semantic clues to the renderer that the transaction  description and amount columns are of fundamentally different types, and have different rendering expectations.

Does MathML provide a way to render the description column left-aligned and the amount column right-aligned? Even if it did, I&apos;ve already got a pragmatic (though suboptimal) solution that has a better reach (decorating each cell).

Honestly, I&apos;d like to see a C printf-style (or .NET String.Format or XPath format picture) format specifier supported by the col element (or at the CSS level), so each table datum could be separated from the presentation entirely, and provided in a more compact/direct way, though I doubt there&apos;s much appetite for this. 

I&apos;m guessing a simple semantic number cell element would have broad appeal, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61336</commentid>
    <comment_count>10</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-12-09 22:14:22 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; OK, try this one: http://webcoder.info/test/sqldata.html

Which cells do you want right-aligned?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61385</commentid>
    <comment_count>11</comment_count>
    <who name="Brian Lalonde">brian</who>
    <bug_when>2011-12-10 07:06:18 +0000</bug_when>
    <thetext>(In reply to comment #10)
&gt; Which cells do you want right-aligned?

In this case, the rightmost two, but examples for each could be useful.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61515</commentid>
    <comment_count>12</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-12-14 00:29:37 +0000</bug_when>
    <thetext>Well with the way the table is done right now, the following rule would do what you want:

   td + td + td + td { text-align: right; }

That doesn&apos;t seem like &quot;much more work than it should be&quot;. And it&apos;ll be even easier once CSS selectors for tables are implemented.

The reason I asked is that honestly, I wouldn&apos;t have thought you&apos;d want the dates right-aligned, and I would have thought you&apos;d want the numbers in the fourth column right-aligned but no the text. To get that effect would need classes on each cell; a &lt;col&gt; attribute wouldn&apos;t work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61522</commentid>
    <comment_count>13</comment_count>
      <attachid>1051</attachid>
    <who name="Brian Lalonde">brian</who>
    <bug_when>2011-12-14 00:51:12 +0000</bug_when>
    <thetext>Created attachment 1051
A more complex alignment challenge

Try and align the the last two columns in all current browsers without decorating each cell.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61524</commentid>
    <comment_count>14</comment_count>
    <who name="Brian Lalonde">brian</who>
    <bug_when>2011-12-14 01:06:43 +0000</bug_when>
    <thetext>The columns I was talking about were for the URL I gave, not the simplified test file I attached later.

I&apos;ve attached the original (more complex) alignment challenge.

As you can see, the rowspans make selecting by sibling position (td + ... + td or td:nth-child(n)) impossible.

The proposed future CSS selector :nth-col() could simplify this for situations where CSS selectors may be applied, but there isn&apos;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&apos;s viability.

&gt; To get that effect would need classes on each cell; a &lt;col&gt; attribute wouldn&apos;t work.

That depends on the browser (Opera and IE do align by column), but you are correct, as a cross-browser solution, it fails. Which is my point. Decorating each cell is a pretty suboptimal solution.


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 (&lt;tn&gt; rather than &lt;td class=n&gt;), and wouldn&apos;t require an external style rule to work.

Not only would this achieve the practical goals of reducing the size and allowing the browser to align the column correctly, it might also allow for more appropriate sorting of that column or other operations that require better type awareness.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63226</commentid>
    <comment_count>15</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-01-28 18:07:00 +0000</bug_when>
    <thetext>(In reply to comment #14)
&gt; 
&gt; I&apos;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&apos;s theoretically possible that there be tables where you&apos;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&apos;t handle it are far and few between, rare enough that it doesn&apos;t make sense to optimise the language for those cases.


&gt; The proposed future CSS selector :nth-col() could simplify this for situations
&gt; 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&apos;s something that is of interest. (The &apos;//&apos; combinator has in the past been proposed for &quot;has a semantic relationship to&quot;.)


&gt; but there isn&apos;t really a way to add that to
&gt; a forum post or a wiki or other user-contibuted content (or CMS body content)
&gt; that only allows markup, so that reduces it&apos;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&apos;t offer a way to change the colour of text, even though sometimes the preferred way to indicate a particular semantic is colour.


&gt; &gt; To get that effect would need classes on each cell; a &lt;col&gt; attribute wouldn&apos;t work.
&gt; 
&gt; That depends on the browser

I was specifically talking about the case where you wanted the numbers right-aligned but not the dates. &lt;col&gt; can&apos;t even do that theoretically.


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

There&apos;s a number of ways of doing this within a site (e.g. class values, data-* attributes, the &lt;data&gt; and &lt;time&gt; 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&apos;t seen this kind of thing much. More objective research would be useful.


EDITOR&apos;S RESPONSE: This is an Editor&apos;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&apos;t justified by its cost-benefit ratio.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63267</commentid>
    <comment_count>16</comment_count>
    <who name="Brian Lalonde">brian</who>
    <bug_when>2012-01-28 23:28:48 +0000</bug_when>
    <thetext>(In reply to comment #15)

Reopening because I believe there was some misunderstanding. I&apos;ll try to clarify.

I see that your CSS does work for the example, but it would be particularly fragile. Adding a column between or after those two, with any differing alignment needs, would break it.

:nth-col() would be more durable in the face of rowspans, but still requires keeping the CSS in perfect sync with the markup. The &apos;//&apos; combinator allows some decoupling of presentation from position, but requires CSS support, and provides no numeric semantics, by which I mean potential support for localized presentation (commas &amp; decimals), numeric sorting, database import, advanced indexing &amp; querying, &amp;c.

&gt; In such a context [user-generated content]
&gt; you can just define a class value for the styles you want and
&gt; let users use that. This is the same as how HTML doesn&apos;t offer a way to change
&gt; the colour of text, even though sometimes the preferred way to indicate a
&gt; particular semantic is colour.

I was speaking as a user, not as the sysadmin. All of these solutions require nontrivial CSS control.

User-authors of forum posts, wikis, other user-contributed content, and even emails, rarely have access to directly manage the CSS.

&gt; &gt; Since we are already decorating each cell, why not provide a semantic element
&gt; &gt; that at least provides a hint to the renderer as to the fundamental type of the
&gt; &gt; data. A semantic element would be far more concise (&lt;tn&gt; rather than &lt;td
&gt; &gt; class=n&gt;), and wouldn&apos;t require an external style rule to work.
&gt; 
&gt; There&apos;s a number of ways of doing this within a site (e.g. class values, data-*
&gt; attributes, the &lt;data&gt; and &lt;time&gt; elements); if this is something that gets a
&gt; lot of adoption, it would make sense to provide a more formal solution. 

Decorating each cell is exactly the &quot;work&quot; I&apos;m referring to:

    &lt;td align=right&gt; - The only one that works in user-contrib contexts, WYSIWYG editors, and most emails. Presentational markup. No built-in numeric semantics.
    &lt;td class=n&gt; - The current solution for site admin contexts. Verbose, and no built-in semantics. Requires add&apos;l CSS support.
    &lt;td data-type=n&gt; - No built-in semantics. Requires add&apos;l CSS support.
    &lt;td&gt;&lt;data value=999.99&gt;999.99 - Still no semantics, and redundant.

vs.

    &lt;tn&gt; - Built-in numeric semantics AND formatting. Efficiently terse.

Would the benefits of a more formal solution (supporting highly granular datatypes such as various date and time levels, booleans, durations, &amp;c.) to support localized presentation and sorting be worthwhile? I&apos;m not sure the expectations for those types are as consistent.

&gt; But in practice I haven&apos;t seen this kind of thing much. More objective research would
&gt; be useful.

I&apos;m a bit incredulous that you haven&apos;t seen much use of numeric data in tables that the author (who may not control the CSS for the site) wishes to be right-aligned (is this culture-dependant?), with the hope that the browser will be just aware enough of the broad datatype to better display it (and maybe more). It&apos;s possible I&apos;ve misunderstood your statement.

More objective research would certainly be useful, especially if it presents any statistical findings as tabular data with numeric columns! ;)

As always, thanks for your time!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63350</commentid>
    <comment_count>17</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-01-30 20:07:00 +0000</bug_when>
    <thetext>&gt; I see that your CSS does work for the example, but it would be particularly
&gt; fragile. Adding a column between or after those two, with any differing
&gt; alignment needs, would break it.

Show me a site where this is a real problem. Unless there&apos;s a compelling case to be made that this problem exists a lot, we shouldn&apos;t address it.


&gt; :nth-col() would be more durable in the face of rowspans, but still requires
&gt; keeping the CSS in perfect sync with the markup. The &apos;//&apos; combinator allows
&gt; some decoupling of presentation from position, but requires CSS support, and
&gt; provides no numeric semantics, by which I mean potential support for localized
&gt; presentation (commas &amp; decimals), numeric sorting, database import, advanced
&gt; indexing &amp; querying, &amp;c.

The &quot;numeric semantics&quot; are already present in the page, by virtue of the data being numeric. That&apos;s machine-detectable.

I don&apos;t see &quot;keeping the CSS in perfect sync with the markup&quot; as being a problem. If you really find this difficult you can just put the CSS in a scoped &lt;style&gt; block before the table.


&gt; All of these solutions require nontrivial CSS control.

We&apos;re talking here about a few lines of CSS to set classes on TD elements. That _is_ trivial.


&gt; User-authors of forum posts, wikis, other user-contributed content, and even
&gt; emails, rarely have access to directly manage the CSS.

They don&apos;t need to manage it, they just need to know the classes that site has available.


&gt; Decorating each cell is exactly the &quot;work&quot; I&apos;m referring to:
&gt; 
&gt;     &lt;td align=right&gt; - The only one that works in user-contrib contexts,
&gt; WYSIWYG editors, and most emails. Presentational markup. No built-in numeric
&gt; semantics.

Only &quot;works&quot; as far as you can style the alignment. In practice, what you really want is decimal alignment, precise control over padding, etc.

In non-CSS environments, UAs can already automatically style numeric cells, so it doesn&apos;t help them.

In CSS environments, CSS gives you more control for less work.


&gt;     &lt;td class=n&gt; - The current solution for site admin contexts. Verbose, and
&gt; no built-in semantics. Requires add&apos;l CSS support.

No more or less verbose than align=&quot;&quot;, and yet gives more power in CSS environments, without taking anything away from non-CSS environments.


&gt;     &lt;td data-type=n&gt; - No built-in semantics. Requires add&apos;l CSS support.

Same as class=&quot;&quot;.


&gt;     &lt;tn&gt; - Built-in numeric semantics AND formatting. Efficiently terse.

The backwards-compatibility story here is terrible (it wouldn&apos;t work in any existing browser, and would cause serious difficulties due to the changes it requires in the parser).

Plus, it would be insufficient. What if the content isn&apos;t numeric but is of the form &quot;foo - bar&quot; and you want to align on the hyphen, say?


&gt; Would the benefits of a more formal solution (supporting highly granular
&gt; datatypes such as various date and time levels, booleans, durations, &amp;c.) to
&gt; support localized presentation and sorting be worthwhile?

I&apos;m not even convinced there&apos;s a real problem here, so it&apos;s unclear that any solution is worthwhile. :-)


&gt; &gt; But in practice I haven&apos;t seen this kind of thing much. More objective research would
&gt; &gt; be useful.
&gt; 
&gt; I&apos;m a bit incredulous that you haven&apos;t seen much use of numeric data in tables
&gt; that the author (who may not control the CSS for the site) wishes to be
&gt; right-aligned (is this culture-dependant?), with the hope that the browser will
&gt; be just aware enough of the broad datatype to better display it (and maybe
&gt; more). It&apos;s possible I&apos;ve misunderstood your statement.

I meant that I haven&apos;t seen people marking up their tables to indicate which bits are numeric, which bits are dates, etc. Sure, people use align=&quot;&quot;, but they can use CSS just as easily in the vast majority of cases (more easily, even).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63388</commentid>
    <comment_count>18</comment_count>
    <who name="Brian Lalonde">brian</who>
    <bug_when>2012-01-31 05:48:21 +0000</bug_when>
    <thetext>(In reply to comment #17)
&gt; Show me a site where this is a real problem. Unless there&apos;s a compelling case
&gt; to be made that this problem exists a lot, we shouldn&apos;t address it.

I couldn&apos;t find a single production site using the td + td + ... approach!
Everyone is decorating each cell. There must be a reason for this.

Here&apos;s a few I found quickly:

Wikipedia suggests align=&quot;right&quot; or embedding a two-cell table in each numeric cell for the integer part and the fractional part of the number!
http://en.wikipedia.org/wiki/Help:Table#Decimal_point_alignment
http://en.wikipedia.org/wiki/Usage_share_of_web_browsers (align=&quot;right&quot;)

Compass: &quot;Experience cleaner markup without presentational classes.&quot;
http://compass-style.org/examples/compass/tables/all/
td class=&apos;numeric&apos;

Google Analytics is right-aligning the entire table, then left-aligning text columns
http://www.google.com/analytics/
table class=&quot;Yb&quot; (.Yb td aligned right, td.so aligned left)

Yahoo! Finance
http://finance.yahoo.com/
td id=&quot;yui_3_3_0_2_1327965860085641&quot; (styling individual IDs!)

CNN Money
http://money.cnn.com/data/markets/
td class=&quot;wsod_aRight&quot;

Amazon.com Order history
td align=&quot;right&quot;

BankOfAmerica.com transactions
td class=&quot;trans-balance-cell TL_NPI_Amt&quot;

Woot! account history qty
td align=&quot;right&quot;

NumericaCU.org transactions
td align=&quot;RIGHT&quot;

StackOverflow.com reputation page (leftmost column)
td class=&quot;rep-cell&quot;

What does your bank use?

&gt; The &quot;numeric semantics&quot; are already present in the page, by virtue of the data
&gt; being numeric. That&apos;s machine-detectable.

Loop through each cell in the table to determine which columns are numeric? 
That seems a pretty inefficient methodology!

&gt; I don&apos;t see &quot;keeping the CSS in perfect sync with the markup&quot; as being a
&gt; problem. If you really find this difficult you can just put the CSS in a scoped
&gt; &lt;style&gt; block before the table.

This was discussed some time ago in StackOverflow, where the td + td + ... approach didn&apos;t gain much traction:
http://stackoverflow.com/questions/1332406/better-way-to-right-align-text-in-html-table
IE6 was at least part of the reason then, I think. But it was described as hackish.
Even if you nail down the first td with :first-child so the selector doesn&apos;t &quot;slide&quot;, the moment you change a column of td into th, or reposition the columns, you (your toolset) must remember to update the CSS, where possible. Even when scoped CSS is supported by browsers, I suspect it&apos;ll be disallowed to users on most sites out of security or branding concerns.

Positional CSS selectors seem to violate the DRY principal. What happens when you&apos;ve defined this behavior in a single CSS file across multiple tables and pages, then want to change one or more tables?

&gt; They don&apos;t need to manage it, they just need to know the classes that site has
&gt; available.

That&apos;s assuming the site has created such a class, and wants to support it.

&gt; In practice, what you
&gt; really want is decimal alignment, precise control over padding, etc.

No, I think just decimal alignment. Something like &lt;col align=char&gt;, but functional, and semantically attached to the data rather than maintained elsewhere.
 
&gt; In non-CSS environments, UAs can already automatically style numeric cells, so
&gt; it doesn&apos;t help them.

I&apos;m not familiar with this. Examples?

&gt; The backwards-compatibility story here is terrible (it wouldn&apos;t work in any
&gt; existing browser, and would cause serious difficulties due to the changes it
&gt; requires in the parser).

Agreed. Adding an element, especially one that ruins backward compatibility should be avoided.

However, there seems to be a widespread need for this functionality.

&gt; Plus, it would be insufficient. What if the content isn&apos;t numeric but is of the
&gt; form &quot;foo - bar&quot; and you want to align on the hyphen, say?

That seems to be a strawman. How often does this come up, compared to numeric data? Examples?

&gt; I meant that I haven&apos;t seen people marking up their tables to indicate which
&gt; bits are numeric, which bits are dates, etc. Sure, people use align=&quot;&quot;, but
&gt; they can use CSS just as easily in the vast majority of cases (more easily,
&gt; even).

Numbers have very specific expectations, dates and other types don&apos;t.

If you have widespread examples of numeric data tables that don&apos;t decorate each cell, then I&apos;m likely in error.
Otherwise, the evidence I&apos;ve provided would seem to suggest that there&apos;s an itch out there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70521</commentid>
    <comment_count>19</comment_count>
    <who name="">contributor</who>
    <bug_when>2012-07-18 15:55:31 +0000</bug_when>
    <thetext>This bug was cloned to create bug 18026 as part of operation convergence.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81675</commentid>
    <comment_count>20</comment_count>
    <who name="Robin Berjon">robin</who>
    <bug_when>2013-01-21 15:58:20 +0000</bug_when>
    <thetext>Mass move to &quot;HTML WG&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81793</commentid>
    <comment_count>21</comment_count>
    <who name="Robin Berjon">robin</who>
    <bug_when>2013-01-21 16:01:06 +0000</bug_when>
    <thetext>Mass move to &quot;HTML WG&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82670</commentid>
    <comment_count>22</comment_count>
    <who name="Edward O&apos;Connor">eoconnor</who>
    <bug_when>2013-02-06 23:57:31 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;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: This is already possible in CSS, as has been previously
described on this bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1050</attachid>
            <date>2011-12-08 16:53:21 +0000</date>
            <delta_ts>2011-12-08 16:53:21 +0000</delta_ts>
            <desc>Column alignment test/example</desc>
            <filename>colalign.html</filename>
            <type>text/html</type>
            <size>844</size>
            <attacher name="Brian Lalonde">brian</attacher>
            
              <data encoding="base64">PCFkb2N0eXBlIGh0bWw+DQo8c3R5bGUgdHlwZT10ZXh0L2Nzcz46bnRoLWNvbCgzKSB7dGV4dC1h
bGlnbjpyaWdodH08L3N0eWxlPg0KPHRhYmxlIGJvcmRlcj0xPjxjYXB0aW9uPmFsaWdubWVudCB0
ZXN0PC9jYXB0aW9uPg0KPGNvbCBhbGlnbj1yaWdodD48Y29sIHN0eWxlPSd0ZXh0LWFsaWduOnJp
Z2h0Jz4NCjx0aGVhZD48dHI+PHRoPjxjb2RlPiZsdDtjb2wgYWxpZ249cmlnaHQvJmd0OzwvY29k
ZT48dGg+PGNvZGU+Jmx0O2NvbCBzdHlsZT0ndGV4dC1hbGlnbjpyaWdodCcvJmd0OzwvY29kZT48
dGg+PGNvZGU+Om50aC1jb2woMyk8L2NvZGU+DQo8dGJvZHk+DQo8dHI+PHRkIHJvd3NwYW49Mj5B
MTx0ZD5CMTx0ZD5DMQ0KPHRyPjx0ZD5CMjx0ZD5DMg0KPHRyPjx0ZD5BMzx0ZD5CMzx0ZD5DMw0K
PHRyPjx0ZD5BNDx0ZD5CNDx0ZD5DNA0KPHRyPjx0ZD5BNTx0ZD5CNTx0ZD5DNQ0KPC90YWJsZT4N
Cjx0YWJsZSBib3JkZXI9MT48Y2FwdGlvbj5UcmFuc2FjdGlvbiBTYW1wbGU8L2NhcHRpb24+DQo8
Y29sPjxjb2w+PGNvbCBhbGlnbj1yaWdodD4NCjx0aGVhZD48dHI+PHRoPkRhdGU8dGg+RGVzY3Jp
cHRpb248dGg+QW1vdW50DQo8dGJvZHk+DQo8dHI+PHRkPjEyLzEvMjAxMTx0ZD5QZXJpbC1TZW5z
aXRpdmUgU3VuZ2xhc3Nlczx0ZD4xLDIzOC4xMA0KPHRyPjx0ZD4xMi8xLzIwMTE8dGQ+U2F0Y2hl
bDx0ZD43Mi4yMg0KPHRyPjx0ZD4xMi8yLzIwMTE8dGQ+U3ViLWV0aGEgc2VydmljZSAmYW1wOyBy
b2FtaW5nIGZlZTx0ZD4yMywyNDEuODkNCjx0cj48dGQ+MTIvNC8yMDExPHRkPk9sJyBKYW54IFNw
aXJpdCBCb3R0bGluZyBDbyBnaWZ0IHNob3A8dGQ+MTEyLjQyDQo8L3RhYmxlPg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1051</attachid>
            <date>2011-12-14 00:51:12 +0000</date>
            <delta_ts>2011-12-14 00:51:12 +0000</delta_ts>
            <desc>A more complex alignment challenge</desc>
            <filename>sqldata.html</filename>
            <type>text/html</type>
            <size>4257</size>
            <attacher name="Brian Lalonde">brian</attacher>
            
              <data encoding="base64">PCFkb2N0eXBlIGh0bWw+DQo8aHRtbD48aGVhZD48dGl0bGU+U1FMIFNlcnZlciBEYXRhdHlwZXMg
UXVpY2tSZWY8L3RpdGxlPjwvaGVhZD4NCjxib2R5PjxoMT5TUUwgU2VydmVyIERhdGF0eXBlcyBR
dWlja1JlZjwvaDE+DQo8aDI+RGF0YXR5cGVzPC9oMj4NCjx0YWJsZSBib3JkZXI9MT48Y2FwdGlv
bj5EYXRhdHlwZXM8L2NhcHRpb24+PGNvbCBzcGFuPTIvPjxjb2wgc3Bhbj0yIGNsYXNzPW1pZC8+
PGNvbCBzcGFuPTIgY2xhc3M9bnVtZXJpYy8+DQo8dHI+PHRoPkZhbWlseTwvdGg+PHRoPm5hbWU8
L3RoPjx0a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