- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Wed, 14 Jul 2004 22:42:35 -0500
- To: www-style@w3.org
I have an interesting question regarding the interaction of "position", "float",
and "display"... Consider the following CSS and HTML:
<html>
<head>
<style type="test/css">
#test {
position: absolute;
float: left;
display: inline;
}
</style>
</head>
<body>
<p>First line <span id="test">Still first line? Where?</span></p>
</body>
</html>
Now per CSS2.1 section 9.7 [1] the computed value of float is 'none' and display
is set to 'block' (see the table in said section).
All well and good. But now we go to lay out the content. Since we have an
absolutely positioned box all of whose offsets are auto and whose width is auto,
we have to find the static position (per section 10.3.7 [2]). Now if the
position had been 'static', then float would not compute to 'none', and the
display would still compute to block. So the static position would be at the
far left end of the first line of the paragraph.
Is this in fact what the specification requires? That the static position be
the position the float would have floated to were it not positioned? That
computation gets a bit more complicated if there are other floats present, of
course...
-Boris
[1] http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo
[2] http://www.w3.org/TR/CSS21/visudet.html#static-position
[3] Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=237770
Received on Wednesday, 14 July 2004 23:42:49 UTC