Closed
Bug 293599
Opened 20 years ago
Closed 20 years ago
<div style="text-align:center"> does not work but <div align="center"> does
Categories
(Firefox :: General, defect)
Tracking
()
People
(Reporter: thecrimson, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
I tried to align some elements using <div style="text-align:center">...</div>
but they where still algined to the left. When I used <div
align="center">...</div> all worked perfectly well.
I tried to enter both parameters (<div align="center"
style="text-align:center">...</div>
Reproducible: Didn't try
Steps to Reproduce:
See Details
Actual Results:
See Details
Expected Results:
Both variants should result in the same rendering
Comment 1•20 years ago
|
||
I suspect you are talking about centering tables or other such elements, in
which case the results you see are correct according to the CSS spec. If this is
not the case then can you attach a testcase.
Comment 2•20 years ago
|
||
I have this problem as well.
It happens on Linux as well as windows, and is with Firefox 1.0.4
I'm using div tags, and it only happens when I apply a width with CSS.
When I set the width text-align: center doesn't get inherited from the parent div.
<html>
<head>
<style>
.Page {
text-align: center;
}
.Header {
width: 100px;
height: 50px;
}
</style>
</head>
<body>
<div class="Page"> <!-- Changing to align="center" works /-->
<div class="Header">
Hello
</div>
</div>
</body>
</html>
Comment 3•20 years ago
|
||
In the case given, firefox appears to be behaving correctly to me. The text is
centered within the div. But the div is only a little larger than the text itself.
The align attribute itself is deprecated in html, so I guess there isn't a
"correct" rendering for it.
Also, it makes life easier if you post testcases as attachments to the bug.
Mossop
Comment 4•20 years ago
|
||
Test case:
http://www.hyperpublish.com/firedivbug/
As you can see:
<div align=center style=s2> (with s2 being additionally a text-align=center
style) does not work when there is a table within the paragraph.
you can see:
http://www.hyperpublish.com/firedivbug/firebug_style.css
DIV.s2 {
font-family:"Arial";
font-size:10pt;
color:#000000;
margin-left:3mm;
margin-right:3mm;
margin-top:0mm;
margin-bottom:0mm;
text-indent:0mm;
text-align:center;
list-style-type:none; }
So there are 2 things that say the paragraph (table) must be centered and you
are not centering it.
Same page perfectly aligns with all Opera, IE, Netscape.
And <DIV align=center> is allowed since Netscape 3.0 (I know as I used it, I am
on the Web since 1995 and since Mozilla and Netscape 1.0). I know that now more
prolix tags are suggested, and DIV align is deprecated, but thousand pages still
contains it (NS 3.0 was out around 1996) and I strongly like to optimize the
software for SMALL CODE SIZE.
Please fix your bug, thanx :)
Aldo
Comment 5•20 years ago
|
||
The original reporter and Nigel are talking about being unable to center child
elements using the text-align style. This is bug 22816.
aldo ghigliano, you are talking about a slightly different issue where it seems
that the test-align style essentially overrides the align attribute. See bug 167685.
Comment 6•20 years ago
|
||
Dave is right, text-align applies only to text, to center align blocks, use
margin: auto.
*** This bug has been marked as a duplicate of 22816 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Comment 7•20 years ago
|
||
Hi! Hope I'm not duplicating too much.
Please see the code:
it is <div align=center class=s2>
and the text-align: center
Tell me now a good "common sense" reason for a left alignment.
All Internet Explorer, Opera, and Netscape since 3.0 does align to center.
I know this because that code is automatically generated with our software
(100000+ free and paid users) and yours is the only known issue.
You need to log in
before you can comment on or make changes to this bug.
Description
•