Skip to content

table borders: single border display bug with border-collapse: collapse #752

Closed
@gandboy91

Description

@gandboy91

When some cell borders are hidden (as 2, 3 and 4 cells in example)
There's buggy behavior of table borders in generated pdf.
It's usually ok with default 100% zoom level.
But if it's zoomed in or zoomed out, some borders looks very unstable (cell 3 in example)
Depending on zoom level it can be thinner or thicker than other borders.

example is created with openhtmltopdf sandbox.
html

image

image
image

markup

<table>
  <tr>
    <td>1</td>
    <td class="no-border-right">2</td>
    <td class="no-border-left no-border-right">3</td>
    <td class="no-border-left">4</td>
  </tr>
  <tr>
    <td>5</td>
    <td>6</td>
    <td>7</td>
    <td>8</td>
  </tr>
</table>

css

table {
  border-collapse: collapse;
  border: 1px solid black;
}
table td {
  border: 1px solid black;
  width: 100px;
}
table td.no-border-right {
  border-right: none;
}
table td.no-border-left {
  border-left: none;
}

P.S. even without border collapse, with cellpadding="0" and some tricks
like display only right and bottom cell borders and for all table left and top borders
(to make sure that there's indeed only single border everywhere)
border thickness is displayed buggy when zoom in/zoom out

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions