Version: 3.2.2 (using KDE 3.2.3, (testing/unstable)) Compiler: gcc version 3.3.4 (Debian 1:3.3.4-5ubuntu2) OS: Linux (i686) release 2.6.8.1-3-686-smp If I have a container div - with position: absolute and no width - and put a div - with a relative width - inside it, the displayed width of all elements is incorrect.
Created attachment 9972 [details] Test case
By comparing the rendering Firefox and Konqueror gave me, I believe Konqueror is correct and Firefox isn't. A div with no width (width: auto) means it'll have the size of its child objects. 40% of undefined is still undefined. That could be wrong, though. Firefox, on the other hand, rendered the container div with 100% width, but the contained ones - 40% and 50% - were far from that.
In Internet Explorer, Opera and Firefox the container width is 100%. In Firefox the child objects take the width of the text because of float and the fact that the text is less than 40% wide. This is could be incorrect behaviour. I don't know. But in Konqueror, block 1 (40%) is narrower than the width of the text inside and block 2 (50%) is wider than the width of the text inside. So the container has not the full width of its child objects, but some other value. It appears that the container is 40% of the page width. This would mean that the container inherits the relative width of its first child object. If this is the case, that doesn't seem logic to me. If the container has a single child object Firefox and Konqueror behave the same. They take the width of the child object. The bug might be caused by the use of float. If I use float: right for the child object, the container should be 100% (I think). This doesn't happen in Konqueror. See test case 2.
Created attachment 9986 [details] Test case 2
absolutely positioned objects with 'auto' value for left, right and width has a shrink-to-fit width (as specified by CSS 2.1 10.3.7), so our rendering is correct. As your inner objects are percentage-sized and thus refers to the width of the containing block which itself is auto, the resulting layout is just undefined in CSS 2.1. Sometimes our fallback layout will match one browser or the other, sometimes it won't. Here, we calculate the maximum width of all child objects and make that the width of the container (shrink-to-fit), then divide this width in 40 and 50 percent shares. This is a very reasonable fallback... Your test case 2 is interesting though. The two blocks should definetly be identical.
Is there any defacto fail back here? Does MSIE and Firefox do the same?
The containers in Testcase 2 are still not identical, updating version.
Thank you for the bug report. As this report hasn't seen any changes in 10 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved.