Closed
Bug 123419
Opened 23 years ago
Closed 23 years ago
CSS text-align not working for Tables
Categories
(Core :: Layout, defect)
Tracking
()
People
(Reporter: ray.au, Assigned: attinasi)
Details
Attachments
(1 file)
508 bytes,
text/html
|
Details |
From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.7+) Gecko/20020115 BuildID: 2002011503 If I specify a <DIV> with the CSS property "text-align:center" tables within the <DIV> will not center, but text works just fine. Take this code for example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head></head> <body> <div style="text-align:center"> some text <table border="1" width="500" cellpadding="0" cellspacing="0"> <tr> <td>hello</td> </tr> </table> more text </div> </body> </html> Notice "some text" and "more text" is properly centered within the page, but the table is not. "text-align" is supposed to apply to block-level elements. Shouldn't this then apply to <TABLE>'s too? Reproducible: Always Steps to Reproduce: 1. load page with the html Actual Results: <TABLE>'s seem to be using the default alignment as if the text-align from the stylesheet was ignored. Expected Results: <TABLE> should be center aligned as per stylesheet rules.
Adding a sample html file to show "problem." Notice text and images (a dead image) align properly.
Comment 2•23 years ago
|
||
Well this is because of the simple fact that a table is not text. Which is why the text is aligned, but not the table. If you want to center the table you need table { margin-left: auto; margin-right: auto; } The same holds true for any other block level element you wish to "center"
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
Comment 3•23 years ago
|
||
Actually this is a dupe of bug 49274
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Comment 4•23 years ago
|
||
...But my original comments still stand. *** This bug has been marked as a duplicate of 49274 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago → 23 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•