Closed Bug 320344 Opened 15 years ago Closed 14 years ago

auto margins on overflow:hidden block without border ignore floats

Categories

(Core :: Layout: Block and Inline, defect, P2)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: gusrichter, Unassigned)

References

Details

(Keywords: testcase, Whiteboard: [reflow-refactor])

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

Span centering between floats problem demonstrated in the attachment.


Reproducible: Always

Steps to Reproduce:
1. Run the attachment.
2.
3.

Actual Results:  
Fx does not center the span between floats, whereas Opera and IE do.


Expected Results:  
The span should be centered as in Opera and IE.


Detailed information is in the attachment.
Component: General → Style System (CSS)
Product: Firefox → Core
Version: unspecified → Trunk
Keywords: testcase
Severity: normal → major
OS: Windows XP → All
As far as I understand the spec [1], the floats impact only the inline content where I think the SPAN elements with 'display: block' should be centered relatively to the H1 container, not relatively to the space between the floated elements. May be this is related to all issues about HR elements rendedered around floated elements (IIRC, once HR borders were rendered over the floated element).

[1] http://www.w3.org/TR/CSS21/visuren.html#floats
In addition to the comment in the description to the attachment 205933 [details], I don't see any mention the floats should impact the available width in a containing block for other block elements, just this <http://www.w3.org/TR/CSS21/visudet.html#blockwidth>:

> If both 'margin-left' and 'margin-right' are 'auto', their used values are 
> equal. This horizontally centers the element with respect to the edges of the 
> containing block.
Attached file Different behaviors
(In reply to comment #3)

I'm sorry Stanimir but I'm not sure if you're agreeing that this is a bug or not.
Opera and IE render it as expected.
You question how a block should be displayed between floats. Don't forget that <h1> is a block and is centered. The <span> is using display:block so should be centered likewise.

Included another Attachment to demonstrate different behaviors.
The heading text is flowed beside the first two examples and between the floats in the third example.
Firefox does not render as IE and Opera, unless a border or margin is applied, or overflow is removed.
This attachment demonstrates how Fx gets it wrong in the three instances.
(In reply to comment #4)

Please delete/ignore this portion:

> Don't forget that
> <h1> is a block and is centered. The <span> is using display:block so should be
> centered likewise.

Birthday party tonight - pressure to get ready - not thinking straight - will look more deeply into this tomorrow.
(In reply to comment #5)

Sorry about the regretful spur of the moment comment. Here is some more, but more carefully thought out:

I believe that the block box should be out of the normal flow and ignore the float, and center overall.
Opera and IE seem to display it as inline or inline-block and center it over the remaining space (wrong IMHO).
Fx on the other hand displays it something completely different (wrong IMHO).

Whiteboard: [reflow-refactor]
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → dbaron
QA Contact: general → ian
Assignee: dbaron → nobody
Component: Style System (CSS) → Layout: Block and Inline
QA Contact: ian → layout.block-and-inline
FWIW, CSS2.1 section 9.5 says:

# The margin box of a table, a block-level replaced element, or an element in
# the normal flow that establishes a new block formatting context (such as an
# element with 'overflow' other than 'visible') must not overlap any floats in
# the same block formatting context as the element itself. If necessary,
# implementations should clear the said element by placing it below any
# preceding floats, but may place it adjacent to such floats if there is
# sufficient space.

However, for this to really apply to auto margins, sections 10.3.3 (and 10.3.4?) should probably be changed as well.
Summary: Span not centered properly between floats → overflow:hidden block with no border not centered properly between floats
Summary: overflow:hidden block with no border not centered properly between floats → auto margins on overflow:hidden block without border ignore floats
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20061208 Minefield/3.0a1 ID:2006120812 [cairo]

seems fixed after reflow branch landing
Status: NEW → RESOLVED
Closed: 14 years ago
Depends on: reflow-refactor
Resolution: --- → FIXED
Need a testcase in the regression suite.
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.