DIV inside a table cell is aligned according to HTML align rule, regardless of CSS margin rule

NEW
Unassigned

Status

()

Core
Layout: Block and Inline
15 years ago
8 years ago

People

(Reporter: Martin Rebane, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

15 years ago
User-Agent:       Opera/6.05 (Windows XP; U)  [en]
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4a) Gecko/20030326

When i use align="center" in table cell and have DIV inside that cell which has a margin-left property set, Mozilla(both 1.3 and the latest nightly on WIN xp) aligns the DIV to the center of the cell, NOT taking into account that margin-rule is set. While I think it should, because:
a)CSS should overwrite HTML properties
b)CSS rule is applied to the nested element, while the HTML rule is applied to the container element

Reproducible: Always

Steps to Reproduce:
1.make a html table with one cell(width: 320) and set align="center" to it
2.inside that sell, make a DIV(width: 300) and set margin-left: 20px;

Actual Results:  
you should see div aligned 20px from the left border of the cell, instead you see it centered

Expected Results:  
place the DIV 20px from the left border of the table cell
Looking at the computed style, our HTML-to-style mapping is converting
align="center" to "text-align: -moz-center". How -moz-center is supposed to
work, I don't know...

Comment 2

15 years ago
Created attachment 118615 [details]
testcase with a div

Comment 3

15 years ago
this has nothing to do with tables, see testcase
Assignee: table → block-and-inline
Component: Layout: Tables → Layout: Block & Inline
QA Contact: madhur → ian

Comment 4

15 years ago
This seems to be related to Bug 185411: in the test case, if you change the
border CSS of the DIVs to be 'border-top' only, or remove the border entirely,
the alignment of the DIV is as expected in either a DIV or table-cell container.

Not quite a dupe, tho, I don't think.

I'm confirming this bug
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4a) Gecko/20030401
(also in 1.3 Final)
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All

Comment 5

14 years ago
The fix for bug 185411 is now in 1.7a builds.  The third item in the test case 
attached to this bug used to render incorrectly, but now renders as reporter 
expected; but the second item's DIV is still centered -- which is this bug.

And again, if the border is changed to 'border-top' across the board, all divs 
are positioned correctly.
Assignee: layout.block-and-inline → nobody
QA Contact: ian → layout.block-and-inline
You need to log in before you can comment on or make changes to this bug.