Skip to content

Incorrect text positioning around floats with padding #416

@DRKV333

Description

@DRKV333

The following document is rendered incorrectly.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
 <head>
  <title>CSS Test: Text Not Fitting Beside Non-Replaced Float</title>
  <style type="text/css">
   p { color: navy; }
   .test { width: 15em; margin: 1em; padding: 0; background: white; color: gray; }
   .test p { margin: 0; padding: 1px; }
   .test p.left { float: left; }
   .test p.right { float: right; width: 14.98em; background: teal; color: aqua; text-align: center; }
  </style>
 </head>
 <body>
  <div class="test">
   <p class="left"> TEST: </p>
   <p class="right"> PASS </p>
   fail fail fail fail fail fail fail fail fail fail
   fail fail fail fail fail fail fail fail fail fail
   fail fail fail fail fail fail fail fail fail fail
   fail fail fail fail fail fail fail fail fail fail
   fail fail fail fail fail fail fail fail fail fail
  </div>
  <!-- this test actually failed in Mozilla once -->
 </body>
</html>

It should look like this:
Image

But it actually looks like this:
Image

If the padding on .test p is set to 0, the result is correct.

This is causing problems with #415. The example is from the test case c414-flt-wrap-000.htm where the padding is 0.01em. With integer pixel values this gets rounded down to 0, but the problem does appear when using float pixels. Though it's not specific to float pixels, as the example shows it can also happen in the current version, with a sufficiently large padding value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions