dompdf / dompdf/dompdf

Table td not resized correct when it contains a float img

Open
#851 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug layout tables
Dominant language
PHP
Stars
11.2k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

When an image inside a td element has the float:xxx property set, the td is resized incorrectly, and the image is displayed behind other td-elements.

Minimal example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<title></title>
</head>
<body>
<table border=1>
<tr>
<td><img style="float:right" src="https://placekitten.com/150/75"/></td>
<td>Some Text</td>
</tr>
<tr>
<td>More Text</td>
<td>Blah</td>
</tr>
</table>

</body>
</html>

This should be rendered exactly as the test/dom_table_image.html example, but is not.

This is what the browser (ff 31) shows:

as_html

This is the PDF output:
rendered

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the minimal HTML example and comparing the PDF with test/dom_table_image.html, which the report identifies as the expected rendering. Trace the table and floated-image layout handling, then add or update a regression case so the table cell sizing and image placement match that example.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html, php
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.