Bug 50688 - [testcase] h/v alignment ignored in col/colgroup ignored in table cells
Summary: [testcase] h/v alignment ignored in col/colgroup ignored in table cells
Status: CONFIRMED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml renderer (show other bugs)
Version: 4.9.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 24122 92444 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-11-14 03:13 UTC by Achim Bohnet
Modified: 2012-09-14 11:53 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
testcase (1.34 KB, text/html)
2008-04-06 04:01 UTC, George Goldberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Achim Bohnet 2002-11-14 03:13:06 UTC
Version:           4.0 (using KDE 3.0.9)
Compiler:          gcc version 2.95.4 20011002 (Debian prerelease)
OS:          Linux (i686) release 2.4.18-768

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <title>H - V alignment in table cents</title>
</head>
<body>

<p>For def. see HTML 4.0.1 spec, page 133 (in pdf):  "inheritance of alignment specification".</p>


<table border=1>
<caption>h align col/colgroup inheritance</caption>
<colgroup><col align="right"></colgroup><colgroup span=2 align="center"></colgroup>
<tbody>
<tr><td>--------fill--------------</td><td>---------fill--------</td><td>--------fill-----------</td></tr>
<tr><td>right aligned             </td><td>centered             </td><td>centered               </td></tr>
<tr><td>right aligned             </td><td>centered             </td><td>centered               </td></tr>
</tbody>
</table>


<table border=1>
<caption>v align col/colgroup inheritance</caption>
<colgroup><col valign="top"></colgroup><colgroup span=2 valign="bottom"></colgroup><colgroup>
<tbody>
<tr><td>--------fill--------------</td><td>---------fill--------</td><td>--------fill-----------</td><td></td></tr>
<tr><td>top                       </td><td>bottom               </td><td>bottom                 </td><td>-<br>-</td></tr>
<tr><td>top                       </td><td>bottom               </td><td>bottom                 </td><td>-<br>-</td></tr>
</tbody>
</table>


</body>
</html>
Comment 1 Stephan Kulow 2003-10-29 17:25:41 UTC
mozilla behaves like konqueror, IE behaves as the reporter expects
Comment 2 Emmanuel le Chevoir 2004-03-18 19:31:32 UTC
The problems seems to lie in the way konqueror handles the CAPTION element.

When a CAPTION is set, every single information defined in a later COLGROUP will be discarded. "width" and "align" properties will simply be ignored, as if the colgroup was not here.

try this for example : 

<table border="1"><caption>title of the table</caption><colgroup><col width="200" /><col width="300" /><col width="200" /></colgroup><tbody><tr><td>column 1</td><td>column 2</td><td>column 3</td></tr></tbody></table>

Removing the caption element will solve the problem, so this really seems to be a bug.
Comment 3 Achim Bohnet 2004-05-10 19:57:55 UTC
Following 'Please review your ...'

I've tried my example again (valid html 4.0.1 according to validator.w3.org)
with konqueror 3.2.2 from KDE 3.2.2 and bug is
still there and the same:   h/v alignment is still the default left/middle
respectively.

I've deleted from my example the two <caption> lines as suggested
in comment #2 but without success: alignment is still the default
left/middle as with <caption>

I tried mozilla 1.6 with my example, with and without caption.
mozilla shows the same 'bug' as konqueror, i.e., alignment is
also always left/middle.

Sorry no IE around right now.

Achim
Comment 4 Stephan Kulow 2004-10-31 15:03:45 UTC
*** Bug 92444 has been marked as a duplicate of this bug. ***
Comment 5 Stephan Kulow 2004-11-07 22:22:12 UTC
*** Bug 24122 has been marked as a duplicate of this bug. ***
Comment 6 George Goldberg 2007-12-19 03:35:36 UTC
Is this bug still there in a recent version of KDE, such as 3.5.8 or KDE4.0 RC2?
Comment 7 George Goldberg 2008-04-06 03:59:49 UTC
Bug still present using testcase in svn trunk r793457
Comment 8 George Goldberg 2008-04-06 04:01:09 UTC
Created attachment 24219 [details]
testcase

testcase attached for easier viewing
Comment 9 Samuel Brack 2011-01-01 19:33:47 UTC
Still a bug in 4.5.4, updating version.
Comment 10 Uqbar 2011-03-18 16:26:08 UTC
As long there will be no *real* update on this bug, there will be no fix at all.
Bugs don't "fly away" with version bumps.
This very bug simple comes from copy-pasted code from Netscape:
https://bugzilla.mozilla.org/show_bug.cgi?id=915

I think none is actually paying attention to this kind of HTML rendering bugs.
Comment 11 Gérard Talbot (no longer involved) 2011-07-12 19:03:57 UTC
Konqueror is a CSS browser. Every HTML presentational attribute must be mapped to a CSS property or should be translated/translatable into an equivalent CSS property.

Inline-level content in a cell may be horizontally formatted with 'text-align' property specified on the table cell but not the HTML 4 col element and not the HTML 4 colgroup element. This is given by the CSS 2.1 spec in sections 17.3
http://www.w3.org/TR/CSS21/tables.html#columns
and 17.5.4
http://www.w3.org/TR/CSS21/tables.html#column-alignment

Inline-level content in a cell may be vertically formatted with 'vertical-align'
property but not the HTML 4 col element and not the HTML 4 colgroup element. This is given by the CSS 2.1 spec in sections 17.3 
http://www.w3.org/TR/CSS21/tables.html#columns
and 17.5.3
http://www.w3.org/TR/CSS21/tables.html#height-layout

The current testcase
https://bugs.kde.org/attachment.cgi?id=24219
only tests HTML 4 attributes align and valign on the HTML 4 col element.

CSS 2.1 allows horizontal and vertical formating of cell contents with 'text-align' and 'vertical-align' properties. So there is a perfectly CSS 2.1 compliant workaround for web authors with regards to this bug.

align and valign attributes are absent on col and colgroup elements (and on all table elements) in HTML5: 
HTML5 differences from HTML4
W3C Working Draft 24 May 2011
3.6 Absent attributes
http://dev.w3.org/html5/html4-differences/#absent-attributes

regards, Gérard
Comment 12 Uqbar 2011-07-13 21:06:37 UTC
How can you "better handle with CSS" the horizontal alignment for columns?
A style class for every cell? A Javascript function? Is it actually "better"?

Our occidental centric culture expects tabular data to be organized with items on rows and their properties on columns.
We (I am occidental) expect them to show content alignment consistent with the content type itself:
- text being left aligned
- integers being right aligned
- reals being aligned to the decimal separator
- images being centered.
Something like http://en.wikipedia.org/wiki/Table_(information) .
The current standard, HTML v4.01, clearly embraced such a view since 1999.
Of course you can decide to be a "CSS browser" instead of an "HTML browser".
But then it could sound more like an excuse to simplify the problem than like a technology advance.
And, anyway, I bet none will trash the HTML v4.01 implementation from any browsers, even when HTML5 will become a standard!

HTML5 IS NOT A STANDARD AT ALL.
Maybe it will, but it's not now.
Comment 13 Gérard Talbot (no longer involved) 2011-07-14 00:52:07 UTC
> How can you "better handle with CSS" the horizontal alignment for columns?
> A style class for every cell?

No. Use the adjacent sibling selector.
E.g.
td:first-child + td {text-align: center;}
will center the inline content of cells in the 2nd column of a properly structured table element;
td:first-child + td + td {text-align: right;}
will right-align the cells in 3rd column of a properly structured table element.

> A Javascript function? Is it actually "better"?
The long answer can be read at
"The mystery of why only four properties apply to table columns"
http://ln.hixie.ch/?start=1070385285&count=1

> We (I am occidental) expect them to show content alignment consistent with 
> the content type itself:
> - text being left aligned
> - integers being right aligned
> - reals being aligned to the decimal separator
> - images being centered.

I wish a majority of people would follow such editorial convention ...

> Something like http://en.wikipedia.org/wiki/Table_(information) .

I went to such webpage and read most of it. It states

"
The precise conventions and terminology for describing tables varies depending on the context. Further, tables differ significantly in variety, structure, flexibility, notation, representation and use.
"
and none of the examples it has follows your alignment convention.

> The current standard, HTML v4.01, clearly embraced such a view since 1999.

HTML v4.01 has been unmaintained for years. It has flaws, incoherences and insufficiencies. HTML5 is supposed to correct such issues.

> Of course you can decide to be a "CSS browser" instead of an "HTML browser".

I do not decide this; I was merely stating a fact that is universally shared by other current, stable, released mainstream browsers (IE9+, Firefox 5+, Opera 11.5+, Chrome 12+, Safari 5+). 

Non-CSS presentational hints may be honored by CSS browsers (in particular, if they do not create contradictions, incoherences) but they do not have to; if so, these "are translated to the corresponding CSS rules with specificity equal to 0".

Cells inherit from rows, never from columns: that's the decisive issue here.

> But then it could sound more like an excuse to simplify the problem than 
> like a technology advance.
> And, anyway, I bet none will trash the HTML v4.01 implementation from 
> any browsers, even when HTML5 will become a standard!
> 
> HTML5 IS NOT A STANDARD AT ALL.
> Maybe it will, but it's not now.

Uqbar, if you are looking for a forward-compatible and perfectly CSS 2.1 compliant solution for horizontal alignment of column content in a properly structured table which will work as intended in HTML v4.01 and in HTML5, then I am telling you that there is one and I have provided you with an excellent example.

Gérard Talbot
Comment 14 Uqbar 2011-07-14 08:05:21 UTC
Accordingly to the philosophical view that you and a lot of other people is embracing, there should be no presentation information at all in the HTML itself, but only in the CSS. HTML should be used for structure only.
While this makes possibly things easier for browser developers (all opensource browsers seem to share the same philosophy https://bugzilla.mozilla.org/show_bug.cgi?id=915#c353) the development of software that will output tabular data is made much more complex, as shown in the adjacent siblings quoted example.

HTML v4.01 is the standard since 2000, HTML5 is "work in progress" since 2004.
HTML4 has been clearly designed with developers in mind. Maybe this is not the best choice in the world, but it's the standard.
Deliberately violating the standard (since 2002) is another choice which is very likely the worst one.

Smart interpretations and implementations of real standards tend to be much better than precise implementations of any not-yet-a-standard. IMHO.