From f631cec184a7fd1398e7706ba6679cdd58e5c3ef Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Mon, 5 Mar 2018 01:02:29 +0100 Subject: [PATCH] Remove table border from available width when borders collapse Related to #582. --- weasyprint/layout/tables.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/weasyprint/layout/tables.py b/weasyprint/layout/tables.py index dd0c3383..62a4d813 100644 --- a/weasyprint/layout/tables.py +++ b/weasyprint/layout/tables.py @@ -536,6 +536,10 @@ def auto_table_layout(context, box, containing_block): cb_width, _ = containing_block available_width = cb_width - margins - paddings + if table.style['border_collapse'] == 'collapse': + available_width -= ( + table.border_left_width + table.border_right_width) + if table.width == 'auto': if available_width <= table_min_content_width: table.width = table_min_content_width