Forum Bugs

Table width issue (table-layout: fixed + border-collapse: collapse + box-sizing: border-box)


It looks that all current versions of prince (tested with 12.5 and 13.5) incorrectly renders table widths when table cells have defined widths and borders and have borders and the following CSS is applied.

* {
box-sizing: border-box;

table {
table-layout: fixed;

According to (border-collapse: collapse) spec, I would expect the width of the table to be the sum of the widths of the columns + the border width. The sum of the inner widths + half the border left + half border right thickness. This would be consistent to Chrome, Firefox and IE. It looks to me that Prince is incorrectly accounting for the border thickness even with box-sizing: border-box enabled. This results in tables that are larger then the expected, which is unfortunate when you have multiple tables stacked on-top of each other. Effectively mitigating box-sizing: border-box's effects on borders / padding.

I have attached an example html, along with renders in both Prince and Chrome. From these, you can see in the browser, the tables look different and the same when rendered with prince.

  1. Chrome Table.png4.8 kB
    Chrome Table Render
  2. Prince Table.png19.1 kB
    Prince Table Render
  3. htmltest.html2.1 kB
    Html Test File

Edited by joe.coady

Thanks, we will take a look at this.
This has been fixed in the latest build.