"text-align:center;" doesn't center table (good old bug #49274 alias:"cssCenterTable")

VERIFIED DUPLICATE of bug 49274

Status

()

Core
CSS Parsing and Computation
--
major
VERIFIED DUPLICATE of bug 49274
12 years ago
12 years ago

People

(Reporter: Andrew Owseiko, Assigned: dbaron)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3

For details and examples go to bug #49274 and dups(24:-).


Reading thoroughly the specs...
1* http://www.w3.org/TR/REC-CSS2/text.html#propdef-text-align
"This property describes how inline content of a block is aligned"

2* http://www.w3.org/TR/REC-CSS2/tables.html#column-alignment
cell is block-level element, as div is.
"The horizontal alignment of a cell's content within a cell box is specified
with the 'text-align' property"

both quotes refer just to content(1st quote has nothing about block-level or
inline-level elements if to be overparticular)

3* http://www.w3.org/TR/REC-CSS2/visuren.html#block-level
4* http://www.w3.org/TR/REC-CSS2/visuren.html#inline-level

From the other side let's look at HTML specs
5* http://www.w3.org/TR/html401/present/graphics.html#h-15.1.2
There are examples with <p> which is block-level element (3* example with
<div><p>)
Also there is interesting comment about <center> an the end of 5*

<center><table/></center> = <div aligh="center"><table/></div>
^^^^^^^^^^^^^^^^^^^^^^^^^
= <div style="text-align: center"><table/></div>
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
considering both <table> and <p> are box-level elements(examples in 5* & 3*)

IT'S THE BUG.

Please, prove the opposite, don't guess - PROVE(with references)

Reproducible: Always

Comment 1

12 years ago
Let me ask you this.  Do you agree that the align HTML attribute is not equal to the text-align CSS property?  

The align attribute does affect blocks. But the text-align property only affects inline content.

align: "It is possible to align block elements (tables, images, objects, paragraphs, etc.) on the canvas with the align attribute. "

text-align: "This property describes how inline content of a block is aligned."

This (<div align="center"><table/></div> = <div style="text-align: center"><table/></div> )is not true by those definitions.  

By the examples given in the HTML spec section 15.1.2 on Alignment they are showing how align and text-align can give the same result in a certain situation.  But that does not mean they are the same in all situations.  

Also they say that they are only talking about the text alignment part of the align attribute from the point of the sentence quoted below onward.  Which this sentence is in the first paragraph of the section.
"Here we only discuss the meaning of the align attribute for text."

Comment 2

12 years ago

*** This bug has been marked as a duplicate of 49274 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → DUPLICATE
(Reporter)

Comment 3

12 years ago
Do you agree that paragraph <p> is box-level element (http://www.w3.org/TR/REC-CSS2/visuren.html#block-level)? I guess so.

Do you agree that DIV TABLE TR TD etc are box-level elements also?

Do you agree with last but one  example in  15.1.2. (http://www.w3.org/TR/html401/present/graphics.html#h-15.1.2)
It works for P (box-level element), doesn't it?
Why shouldn't it work for any other box-level element?
Last example in 15.1.2 says "To center the entire document with CSS"
What about tables etc. as a part of document.


http://www.w3.org/TR/REC-CSS2/text.html#propdef-text-align
"This property describes how inline content of a block is aligned"
I don't see here reference to inline-level(it's special term to distinguish two types of content), i just see "inline" which is not "inline-level" (5 more letters)
I would be grateful for comments(refetences) from W3.org about the meaning of "inline content" in that particular phrase. It seems the root of misunderstanding.

<center> is depricated, align attribute is depricated. We have one substitute "text-align" to do the job(for text(inline-level) as for you), what is the other official substitute for box-level(refetence to w3). You may say "auto margins" - a hack as for me, it should be specified in child element to have effect in parent's context

<div align="center">
<table/>
<table/>
</div>


<div>
<table style="margin-left:auto;margin-right:auto;"/>
<table style="margin-left:auto;margin-right:auto;"/>
</div>

You see the difference. I doubt w3 meant it that way.
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---

Updated

12 years ago
Assignee: nobody → dbaron
Component: General → Style System (CSS)
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk

Comment 4

12 years ago
Created attachment 228533 [details]
Last example from 15.1.2

Here's the last example from 15.1.2.  I added borders on all the block level tags.  I may have missed some block level tags but that's not important.

In the first set it looks like the table is different than the rest.  But it is not because it isn't being centered.  The table is different because it is a block that collapses to the size of its content unlike the other blocks that expand their width to width of their container.

The second set shows that indeed NONE of the blocks get centered by text-align.

Comment 5

12 years ago
>It works for P (box-level element), doesn't it?
No it doesn't.  I just wanted to dispel that thought. 
(Assignee)

Comment 6

12 years ago

*** This bug has been marked as a duplicate of 49274 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago12 years ago
Resolution: --- → DUPLICATE

Updated

12 years ago
Status: RESOLVED → VERIFIED
(Reporter)

Comment 7

12 years ago
Created attachment 228785 [details]
To illustrate HTML 4.01 15.1.2

(Reply on comment #4)
It just shows(your example, my example) that browser doesn't even conform test-case from specifications. Was educational to find out.
You need to log in before you can comment on or make changes to this bug.