absolutely positioned child of relative inline containing block is positioned relative to only first line of inline
Categories
(Core :: Layout: Positioned, defect)
Tracking
()
People
(Reporter: rn214, Unassigned)
References
(Depends on 1 open bug, Blocks 2 open bugs)
Details
(Keywords: parity-chrome)
Attachments
(3 files)
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.8) Gecko/2009033117 Mandriva/1.9.0.8-0.1mdv2009.0 (2009.0) Firefox/3.0.8 Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.8) Gecko/2009033117 Mandriva/1.9.0.8-0.1mdv2009.0 (2009.0) Firefox/3.0.8 The child element of an inline div is misplaced. It is actually positioned with respect to the top line of that div, rather than the bottom. Both Opera and Konqueror behave differently, so this is probably a genuine bug. Reproducible: Always Steps to Reproduce: Look at the following HTML. (I'll attach screenshots shortly) <h2>Firefox</h2> BEFORE <div style="position:relative; display:inline; background-color:#0F0"> This is an inline div.<br>Here is the second line<br>And a third line<br>And now a fourth and final line <div style="position:absolute; left: 0; bottom: 0; display:inline; background-color:#F00"> x </div> </div> AFTER Actual Results: The red 'x' is positioned at the TOP of the parent div. It should be placed at the bottom. Both Firefox 3.5 and Firefox 3.6a1 (today's nightly) show the same behaviour. But Opera and Konqueror show different behaviour. Expected Results: The inner div has "bottom: 0", therefore the bottom of the 'x' should be aligned with the bottom of the parent div.
Reporter | ||
Comment 1•16 years ago
|
||
Here is a tarball of 3 png files, showing the rendering in Firefox, Konqueror (3.5) and Opera (9.64) respectively. The HTML source of all of them is exactly the same (excepting that I changed the <h2> to show the correct name)
Updated•16 years ago
|
Reporter | ||
Comment 3•16 years ago
|
||
I think you're probably right. 10 years, and half-a-million bugs later ;-) Any chance of a fix? Web designers now tend to regard Firefox as the de-facto implementation of the standards, and test here first.
Comment 4•16 years ago
|
||
Reopening per bug 5016 comment 32.
Comment 5•16 years ago
|
||
Comment 6•16 years ago
|
||
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2a1pre) Gecko/20090202 Minefield/3.2a1pre Confirmed.
Updated•16 years ago
|
There is an explanation of what needs to be done to fix this starting from bug 5016 comment 17.
We should also figure out what the spec says about bidi issues: see http://lists.w3.org/Archives/Public/www-style/2011Jan/0538.html
Comment 10•11 years ago
|
||
Issue 215 Summary Make it undefined what containing block is formed by a relpos inline that splits across multiple lines URI http://test.csswg.org/suites/css2.1/20110111/html4/containing-block-032.htm (which was removed from /latest/ and /nightly/ : http://test.csswg.org/suites/css2.1/latest/html4/containing-block-032.htm http://test.csswg.org/suites/css2.1/nightly/html4/containing-block-032.htm ) Resolution Make undefined. Status Closed. http://wiki.csswg.org/spec/css2.1#issue-215 " If the element has 'position: absolute', the containing block is established by the nearest ancestor with a 'position' of 'absolute', 'relative' or 'fixed', in the following way: In the case that the ancestor is an inline element, the containing block is the bounding box around the padding boxes of the first and the last inline boxes generated for that element. In CSS 2.1, if the inline element is split across multiple lines, **_the containing block is undefined_**. " CSS2.1, §10.1 Definition of "containing block" http://www.w3.org/TR/CSS21/visudet.html#containing-block-details So, I'd say this bug is not valid for CSS 2.1. CSS3 is a bit different: " If the element has ‘position: absolute’, the containing block is established by the nearest ancestor with a ‘position’ other than ‘static’, in the following way: In the case that the ancestor is inline-level, the containing block depends on the ‘direction’ property of the ancestor: If the ‘direction’ is ‘ltr’, the top and left of the containing block are the top and left content edges of the first box generated by the ancestor, and the bottom and right are the bottom and right content edges of the last box of the ancestor. " CSS Positioned Layout Module Level 3, Working Draft 7 February 2012 §3.1. Definition of containing block http://www.w3.org/TR/css3-positioning/#def-containing-blocks as it now refers to content edges (and not padding edges) and it does not specify what happens if the positioned ancestor inline box is split in multiple line boxes.
Comment 11•10 years ago
|
||
Is there any push at all to implement this? It's inconsistent with all major browsers causing me quite a few headaches. It's been half a year since this was last discussed which is quite alarming.
Comment 12•9 years ago
|
||
Still experiencing this bug, and can confirm it is still inconsistent with Chrome and IE implementation.
Comment 14•8 years ago
|
||
Firefox 49.0.2 fails this test: http://www.gtalbot.org/BrowserBugsSection/css21testsuite/containing-block-017-GT.html as far as CSS2.1 and CSS2.2 are involved. Note that there is only 1 line box in such test. Opera 12.16 (Presto engine), Chrome 54.0.2840.90, Chrome 56.0.2902.0, IE11 and Edge pass this test. - - - - - - - If the positioned ancestor is an inline element split across multiple lines, then Firefox complies with CSS2.x since, in such case, "the containing block is undefined". And all the tests we had with such multiple lines have been removed from CSS2.1 test suite. - - - - - - - (In reply to matt from comment #11) > Is there any push at all to implement this? It's inconsistent with all major > browsers (In reply to tdmalone from comment #12) > Still experiencing this bug, and can confirm it is still inconsistent with > Chrome and IE implementation. Chrome (all versions), IE11 and Edge (all versions) do not comply with CSS3 (and never did) when the positioned ancestor is an inline element *_split across multiple lines_*. Only Opera 12.16 (Presto engine) complies, otherwise passes the tests we have. Regarding CSS Positioned Layout Module Level 3, section 3.1. Definition of containing block https://www.w3.org/TR/css-position-3/#def-cb there will be a CSSWG discussion this month to decide on a proposed modification of CSS3. More info: https://github.com/w3c/csswg-drafts/issues/609
https://github.com/w3c/csswg-drafts/issues/609 proposes changes to the spec here, although probably only a minor adjustment to what we need to do to fix this.
In today's teleconference the CSS WG accepted the proposal in https://github.com/w3c/csswg-drafts/issues/609#issuecomment-259058527
Just poking through quickly now, but there may be more information on this in bug 5016 and bug 255139.
... and bug 629059 is also related.
Comment 22•7 years ago
|
||
The relevant spec text is in css-position-3.
Updated•4 years ago
|
Updated•4 years ago
|
![]() |
||
Updated•3 years ago
|
Updated•2 years ago
|
Comment 27•2 years ago
|
||
The severity field for this bug is relatively low, S3. However, the bug has 8 duplicates.
:dholbert, could you consider increasing the bug severity?
For more information, please visit auto_nag documentation.
Comment 28•2 years ago
|
||
The last needinfo from me was triggered in error by recent activity on the bug. I'm clearing the needinfo since this is a very old bug and I don't know if it's still relevant.
Comment 29•2 years ago
•
|
||
We have these 2 tests (Ahem font must be installed on your system)
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/containing-block-031.html
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/containing-block-032.html
that can be adjusted to be submitted to WPT once Issue 8284 https://github.com/w3c/csswg-drafts/issues/8284 is resolved.
[Edit]
I am really eager to submit these because we have been keeping these for over 13 years now:
https://lists.w3.org/Archives/Public/public-css-testsuite/2010Jul/0046.html
[/Edit]
I think bug 489207 and bug 743599 should be resolved as DUPLICATEs.
Comment 30•2 years ago
|
||
Thanks. And yeah, let's implement whatever behavior shakes out of that spec issue (being discussed in the CSSWG meeting right now).
Comment 33•2 years ago
•
|
||
CSSWG resolution:
RESOLVED: in LTR-tb the top-left corner is the top-left corner of the top-left-most fragment of the first line, and the bottom and right edges are bottommost and rightmost edges of all the fragments. Directionality comes from the inline
(with analogous writing-mode-informed directions for other direction/writing-mode setups. As noted at the end of the resolution, the direction/writing-mode of the inline element, i.e. the thing forming the abspos containing block, is what matters.)
Comment 34•5 months ago
|
||
The linked webcompat issue (https://webcompat.com/issues/58613) is no longer reproducible as the site has changed their design, resetting Webcompat priority
Updated•3 days ago
|
Description
•