Closed Bug 7112 Opened 21 years ago Closed 20 years ago

{compat} ALIGN attribute needs special treatment

Categories

(Core :: Layout, defect, P3, major)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: rekle, Assigned: karnaze)

References

()

Details

(Keywords: css-moz, testcase)

Attachments

(5 files)

Go to a My Yahoo page and look at the "Bookmarks" section.  There is a box
there that says "Add Bookmark" right under the blue box that says "Bookmarks".
This "Add Bookmark" Text should be centered under the blue "Bookmarks" box, but
is instead left aligned.
Assignee: rickg → chrisd
Chris -- can you please make a test case for this and attach it? Thanks.
Attached are two files that may demonstrate the problem. I isolated it down as
far as I could.

The problem may lie with the <td align=middle> tag in the second row of the
outer table.

The first document, '7112_bookmark.html' shows a snippet of the actual page.
Three areas that may effect this problem are:
(1) the <td width="1%"> tag in the first row of the outer table
(2) the <td colspan=2 align=middle> tag in the second row of the outer table

The second example, '7112_bookmark_2.html, is a revision of the original
document somewhat. I changed the width percentage from 1 to 100 and removed the
colspan attribute from the <TD> tag in the second row of the outer table.

Both examples demonstrate the centering problem, but I can't pinpoint it
exactly.
QA Contact: petersen → chrisd
Assignee: rickg → karnaze
Chris -- I've dumped the content model (in both of ChrisD's examples) and it
looks correct. I think this may be yours.
This alignment stuff is really messy because align means two different things in
HTML - on text and on tables - and the CSS text-align property only has the
meaning for text.  This is a complicated quirks mode thing that I think Kipp was
working on a while back - I'll try and dig up some relevant bug numbers.

I have another attachment that's a simpler demonstration - 2 test cases with
explanations.  I'll try and get back to you on exactly how I think this stuff
ought to be handled.  It's messy.
Kipp and I discussed this on March 4, and the end result was that I think the
following should be done (I'm not sure why it isn't working here - see perhaps
bug 6122):

* I assume you're mapping align=middle and align=center on anything to CSS
text-align: center, except perhaps on table elements in quirks mode (see below)

* In standard mode, let CSS inheritance apply, so these can never center a table
- the text inside will be centered

* In quirks mode, if a table ends up with text-align: center (except possibly
from placing text-align: center on the table itself, which is why you may want
to handle things differently when it's on a table), then instead of following
the CSS rules, center the table, and reset text align to the writing direction
(ltr -> left, rtl -> right).

I'm sure there was another bug on this because I remember writing test cases to
see what different browsers did.  I'll look for it.
This test case was actually also from a discussion with kipp.  On March 22, I
wrote (referring to what is now attachment 395 [details]):
---
both IE5 and NN4.5 align tables 1, 3, and 4 centered and 2 left.  The
centering of 4 is contary to the CSS spec.

According to HTML 4.0, 1 should be centered and 3 should *probably* be
left.

According to HTML 3.2, 1 should be centered and 3 should be centered.

Whatever you do, make sure 2 stays left!
---
Kipp may have some insight into this, since he worked on it a bit (although the
problem here seems to be that it doesn't work on *nested* tables, or something
like that).

Note that right now Mozilla is centering tables 1 and 3, while 2 and 4 are on
the left.
*** Bug 6150 has been marked as a duplicate of this bug. ***
Blocks: 3061
*** Bug 8388 has been marked as a duplicate of this bug. ***
Summary: Text not being centered properly → ALIGN attribute needs special treatment
*** Bug 8046 has been marked as a duplicate of this bug. ***
From 8046: IN QUIRKS MODE, the ALIGN attribute on DIV and TD should also
control the alignment of HR elements they contain.

eg:
   <DIV ALIGN=RIGHT>
      <HR SIZE=5>
   </DIV>

That is, HR should act like <TABLE> as far as being treated by ALIGN is
concerned. I think.
*** Bug 8094 has been marked as a duplicate of this bug. ***
*** Bug 7361 has been marked as a duplicate of this bug. ***
*** Bug 6721 has been marked as a duplicate of this bug. ***
Summary: ALIGN attribute needs special treatment → {compat} ALIGN attribute needs special treatment
[TESTCASE]: The 'problem' is illustrated in the following two test cases:

http://www.bath.ac.uk/%7Epy8ieh/internet/projects/mozilla/tablealign.quirks.html
http://www.bath.ac.uk/%7Epy8ieh/internet/projects/mozilla/tablealign.strict.html

The first has no doctype, and so should trigger NavQuirks mode, the second has
an HTML4 Strict doctype, and so should trigger the standards compliant mode.
Otherwise, they contain the same text.
*** Bug 7044 has been marked as a duplicate of this bug. ***
*** Bug 2956 has been marked as a duplicate of this bug. ***
The bug that kipp worked on on this problem was bug 3238.
I just found a message where kipp described his solution to bug 3238.  My
summary:

1) In Compat mode, ALIGN="center" and ALIGN="right" map to -moz-center and
-moz-right rather than center and right (of the text-align property).

2) If a TABLE has -moz-center or -moz-right, then the table moves instead (I
guess the margins are set to auto appropriately, and text-align is set to left.)

This raises a few issues:

1) Did HTML ever have align="justify"?
2) This doesn't handle the compat issues for text-align at all.
3) What else is wrong with it right now.  Is this still happening?

I don't have time to investigate right now...
Whiteboard: [TESTCASE]
Marked [TESTCASE].
Status: NEW → ASSIGNED
Target Milestone: M10
*** Bug 10203 has been marked as a duplicate of this bug. ***
*** Bug 9299 has been marked as a duplicate of this bug. ***
*** Bug 10619 has been marked as a duplicate of this bug. ***
Not sure if y'all were aware of the exact spec according to w3c, but...:
http://www.w3.org/TR/REC-html40/sgml/dtd.html#cellhalign
...unfortunately, many sites use the invalid attribute "middle" for horizontal
alignment, eg. www.thirdnipple.com.
*** Bug 12103 has been marked as a duplicate of this bug. ***
*** Bug 5196 has been marked as a duplicate of this bug. ***
*** Bug 12935 has been marked as a duplicate of this bug. ***
Spoke to karnaze during bug triage today.  Moving to M11.  Not an M10 blocker.
Moving to M13.
Target Milestone: M13 → M14
mass move to m14.
Summary: {compat} ALIGN attribute needs special treatment → {compat} ALIGN attribute needs special treatment {css-moz}
Tentatively marking css-moz as the (proposed? implemented?) fix uses CSS
extensions.
Keywords: css-moz
Bulk moving [testcase] code to new testcase keyword. Sorry for the spam!
Keywords: testcase
Summary: {compat} ALIGN attribute needs special treatment {css-moz} → {compat} ALIGN attribute needs special treatment
Whiteboard: [TESTCASE]
The table portion of this bug is fixed except that <table style="text-align"> 
operates according to the standard in quirks mode (if this is an issue, I can 
make it work that way, but it seems wrong to do it). ChrisD, can you open a new 
bug for the <div> example in the 6/18/99 comments. This bug has gotten too long 
and the original problem is fixed.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
*** Bug 27893 has been marked as a duplicate of this bug. ***
*** Bug 27893 has been marked as a duplicate of this bug. ***
*** Bug 32050 has been marked as a duplicate of this bug. ***
Maybe ALIGN=center on the table should work the same way in quirks and strict 
modes, even though it is deprecated in HTML 4. Reopening the bug.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → ASSIGNED
ALIGN="*" directly on a table should not map to the text-align property at all,
but should map to the margin properties (RIGHT->margin-left: auto,
LEFT->margin-right: auto, or CENTER->both auto).
ALIGN=center no longer get converted to text-align:center in strict mode.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
*** Bug 29627 has been marked as a duplicate of this bug. ***
I reported a problem with <TABLE ALIGN=center>...</TABLE> centreing table
cell contents (the HTML 4.01 spec says it should centre the table, not the
cell contents), but had my bug report (<a
href="http://bugzilla.mozilla.org/show_bug.cgi?id=29627">"#29627</a>) marked
as a duplicate of this bug. Fair enough, I thought, but this bug (7112) is marked as
resolved and fixed and yet the <TABLE ALIGN=center>...</TABLE> issue is *not*
fixed by any means (it renders 1,000 pages on our site wrongly because of
this). Hence, I'm proposing to re-open this bug (or maybe my original 29627
bug should not be marked as a duplicate and should be re-opened ?) in a few
days if someone doesn't argue otherwise.

Example URL showing the problem:
<a
href="http://www.liverpoolfc.net/1999/news/feb/28_05.html">http://www.liverpoolfc.net/1999/news/feb/28_05.html</a>

Could someone comment on this - as far as I'm concerned this is actually a
beta show-stopper (you are going directly against the HTML 4.01 spec and this
means you are not 100% HTML 4.01 compliant !).
I think what you mention is not a bug.  The page you mention uses an XHTML
DOCTYPE, and therefore triggers strict mode.  The structure is:

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

The centering is caused by the center element.  In quirks mode, the table resets
the text-align property.  However, in standard mode, the center applies to
within the table.  The specs don't define an HTML->CSS mapping for the center
element (which is equivalent to a div with align="center"), but I see no reason
that it should be different for different elements in standard mode.  However,
you might be able to convince me otherwise...
*** Bug 19960 has been marked as a duplicate of this bug. ***
Verified
Windows (NT): 2000-07-13-09-M17
Linux       : 2000-07-13-08-M17

Tested with 2 testcases as provided in attachment of 06/24/99 for quirk and 
strict testcases.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.