Re: [CSS21] 9.5.1: placing floats above earlier blocks & line boxes

I believe the initial example was correct and did use what Anton describes as
a wrapper box to have the negative margin.  I'd guess that the problem was just
that there wasn't enough whitespace to notice.  (And the fact that it would be
easy to forget to use a wrapper box for the negative margin.)

Here it is again but with a bit more whitespace to show the wrapper
relationship more clearly, and with div's throughout instead of p/span.
And let's add a stylesheet for some colour, following Alan Gresley's lead.

  <html>
  <head>
  <title>Rules 5 &amp; 6</title>
  <style type="text/css" media="all">
  div { background:silver; color:maroon; }
  div div { background:yellow; color:green; }
  </style>
  </head>
  <body>
  <div>Blah.</div>
  <div>Blah.</div>
  <div>Blah.</div>
  <div>An earlier block and line box</div>
  <div style="margin-top: -3.5em;">
    <div style="float:left;">A float.</div>
  </div>
  </body>
  </html>

pjrm.

Received on Friday, 15 October 2010 02:37:05 UTC