Closed
Bug 49274
(cssCenterTable)
Opened 24 years ago
Closed 24 years ago
"text-align:center;" doesn't center table
Categories
(Core :: Layout: Tables, defect, P3)
Tracking
()
VERIFIED
INVALID
People
(Reporter: kazhik, Assigned: karnaze)
References
Details
(Keywords: compat, testcase)
Attachments
(3 files)
<div style="text-align:center"> doesn't center table. Win98 2000081508
Reporter | ||
Comment 1•24 years ago
|
||
Comment 2•24 years ago
|
||
This differs from IE5 and Nav4.6. As the document has a transitional dtd this should trigger quirks mode and give the same result as Nav4.6. Adding some keywords. But I am not sure what the standard is, how this should behave.
Comment 3•24 years ago
|
||
Comment 4•24 years ago
|
||
Comment 5•24 years ago
|
||
My understanding is that the table as part of the textblock should aligned. http://www.w3.org/TR/REC-CSS2/text.html#propdef-text-align Please see also the difference between strict and transitional testcases. Confirming the bug
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 6•24 years ago
|
||
You should use: table { margin-left: auto; margin-right: auto; } This works in Mozilla and Opera 4; 'text-align: center' should *not* work. Should be marked 'invalid'.
Comment 7•24 years ago
|
||
text-align affects the *text*, hence the name *text*-align. A table is not text.
Reporter | ||
Comment 8•24 years ago
|
||
I can't agree with marking this bug as invalid. (1) <div style="text-align:center"> can center table with IE 5.x and NC 4.x. (2) "text-align" should apply to block elements. table is also a block element. http://www.w3.org/TR/REC-CSS1#text-align
Comment 9•24 years ago
|
||
Yes, text-align *applies* to block elements, in CSS terms. But that does not mean that it *affects* block elements. It *affects* the text content of blocks. The specification is *VERY* clear about this. Read the chapters on the formatting model for details.
Comment 10•24 years ago
|
||
Verified invalid. text-align aligns text, not blocks
Status: RESOLVED → VERIFIED
Comment 11•24 years ago
|
||
*** Bug 63489 has been marked as a duplicate of this bug. ***
Comment 12•24 years ago
|
||
*** Bug 68278 has been marked as a duplicate of this bug. ***
Comment 13•24 years ago
|
||
*** Bug 68954 has been marked as a duplicate of this bug. ***
Comment 14•23 years ago
|
||
*** Bug 73696 has been marked as a duplicate of this bug. ***
Comment 15•23 years ago
|
||
*** Bug 74462 has been marked as a duplicate of this bug. ***
Comment 16•23 years ago
|
||
*** Bug 77501 has been marked as a duplicate of this bug. ***
Comment 17•23 years ago
|
||
*** Bug 78872 has been marked as a duplicate of this bug. ***
Comment 18•23 years ago
|
||
*** Bug 85667 has been marked as a duplicate of this bug. ***
*** Bug 87562 has been marked as a duplicate of this bug. ***
*** Bug 79932 has been marked as a duplicate of this bug. ***
Comment 21•23 years ago
|
||
*** Bug 94928 has been marked as a duplicate of this bug. ***
Comment 22•23 years ago
|
||
*** Bug 94928 has been marked as a duplicate of this bug. ***
Comment 23•23 years ago
|
||
Here is an interesting quote for you: | The table itself is centered, by setting its left and right margins | to 'auto', | [...] | TABLE { | margin-left: auto; | margin-right: auto | } | [...] - CSS2 Specification Visit http://www.w3.org/TR/REC-CSS2/tables.html#q5 to see the original text. So in case someone doubts, it was correct to mark this bug as invalid.
Comment 24•23 years ago
|
||
*** Bug 111325 has been marked as a duplicate of this bug. ***
Comment 25•23 years ago
|
||
*** Bug 111325 has been marked as a duplicate of this bug. ***
Comment 26•23 years ago
|
||
*** Bug 111961 has been marked as a duplicate of this bug. ***
Comment 27•23 years ago
|
||
Is it just me, or does it seem like CSS *should* have a non-text align: table { align: center; } It seems logical to not deprecate a feature unless it is being replace, margin: auto; seems like nothing more then a *hack*, ahh well.
Comment 28•23 years ago
|
||
Well, actually this 'hack' IS what's the official recommendation of the W3C. So mozilla does hanlde this right and should definitly NOT change this behavior because of compatibility issues! If this is 'userfriendly' =) is just another question. I had to take a deep look into the specs myself before realizing this (and after filing a bug for this issue =) - nevertheless it's not mozilla's turn to innovate here. As the W3C recommendations are RFCs (Request for Comment), you just could do so and suggest such a feature. (that's why the RFCs are called so). You could go to http://www.w3.org/Style/CSS/current-work and find out about the plans for CSS3 and actually drop a comment, as they do request so. See? Go there and nag them. And IF this makes it into CSS3, mozilla will certainly render this correctly once.
Comment 29•23 years ago
|
||
*** Bug 119411 has been marked as a duplicate of this bug. ***
Comment 30•23 years ago
|
||
*** Bug 123419 has been marked as a duplicate of this bug. ***
*** Bug 151458 has been marked as a duplicate of this bug. ***
Comment 32•22 years ago
|
||
*** Bug 160049 has been marked as a duplicate of this bug. ***
Comment 33•22 years ago
|
||
*** Bug 184356 has been marked as a duplicate of this bug. ***
Comment 34•22 years ago
|
||
*** Bug 186265 has been marked as a duplicate of this bug. ***
Comment 35•21 years ago
|
||
*** Bug 200423 has been marked as a duplicate of this bug. ***
Comment 36•20 years ago
|
||
*** Bug 245214 has been marked as a duplicate of this bug. ***
Comment 37•19 years ago
|
||
*** Bug 290680 has been marked as a duplicate of this bug. ***
Comment 38•18 years ago
|
||
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)
Comment 39•18 years ago
|
||
Just've raised new bug #343862
Comment 40•18 years ago
|
||
*** Bug 343862 has been marked as a duplicate of this bug. ***
*** Bug 343862 has been marked as a duplicate of this bug. ***
Comment 42•18 years ago
|
||
*** Bug 349391 has been marked as a duplicate of this bug. ***
Comment 43•18 years ago
|
||
Andrew, it's not a bug. I've come here thinking it was a bug, but did a little search about text-align (which is the important thing here) and found this: - This property describes how "inline content of a block" is aligned. - In this example, note that since 'text-align' is inherited, all "block-level elements" inside DIV elements with a class name of 'important' will have "their inline content" centered: div.important { text-align: center } Source: http://www.w3.org/TR/CSS21/text.html#propdef-text-align Note that I've marked with "" the significant parts. Tables are block-level elements, so, in this case all the table's inline content will be centered (style inherited from the div to the table), but not the table itself, since it's not an inline-level element of the div. Daniel is right when he points that the ceneting of block-level elements its something missing in CSS2. I hope, this clear your doubt.
Comment 44•18 years ago
|
||
http://www.w3.org/TR/CSS21/tables.html#column-alignment Interesting, how thas should be interpreted in current context? No "inline", "inline-level", etc. mentioned there.
Comment 47•7 years ago
|
||
I am a newbie can I work on this bug? Is the bug fixed??
You need to log in
before you can comment on or make changes to this bug.
Description
•