Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table (td) doesn't respect max-width and text-overflow #2082

Closed
kesara opened this issue Feb 29, 2024 · 2 comments
Closed

Table (td) doesn't respect max-width and text-overflow #2082

kesara opened this issue Feb 29, 2024 · 2 comments
Labels
bug Existing features not working as expected
Milestone

Comments

@kesara
Copy link
Contributor

kesara commented Feb 29, 2024

WeasyPrint doesn't respect the max-width of td when there's a long word.
And WeasyPrint seems to ignore overflow-wrap: break-word; as well.

Example HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>WeasyPrint table-width test</title>
    <style>
      body {
        max-width: 300px;
      }
      td {
        max-width: 200px;
      }
      .break-word {
        overflow-wrap: break-word;
      }
    </style>
  </head>
  <body>
    <h3>With very long word</h3>
    <p>Lorem ipsum dolor sit amet, verylongnamehere: Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper. Nulla at volutpat diam ut venenatis.</p>
    <h3>With very long word and overflow-wrap: break-word</h3>
    <p class="break-word">Lorem ipsum dolor sit amet, verylongnamehere: Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper. Nulla at volutpat diam ut venenatis.</p>
    <h3>Without a very long word</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper. Nulla at volutpat diam ut venenatis.</p>
    <h3>Table with very long word</h3>
    <table>
      <tr>
        <td>Lorem ipsum dolor sit amet, verylongnamehere: Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper. Nulla at volutpat diam ut venenatis.</td>
      </tr>
    </table>
    <h3>Table with very long word and overflow-wrap: break-word</h3>
    <table>
      <tr>
        <td class="break-word">Lorem ipsum dolor sit amet, verylongnamehere: Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper. Nulla at volutpat diam ut venenatis.</td>
      </tr>
    </table>
    <h3>Table without a very long word</h3>
    <table>
      <tr>
        <td>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper. Nulla at volutpat diam ut venenatis.</td>
      </tr>
    </table>
  </body>
</html>

Expected output (from Firefox):
Screenshot 2024-02-29 at 19 09 11

WeasyPrint version 61.1 output:
Screenshot 2024-02-29 at 19 09 33

@liZe liZe added this to the 62.0 milestone Mar 4, 2024
@liZe liZe added the bug Existing features not working as expected label Mar 4, 2024
@liZe
Copy link
Member

liZe commented Mar 4, 2024

Closed by #2085.

@liZe liZe closed this as completed Mar 4, 2024
@kesara
Copy link
Contributor Author

kesara commented Mar 7, 2024

Thanks for the quick fix @liZe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing features not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants