diff --git a/weasyprint/layout/preferred.py b/weasyprint/layout/preferred.py index 6ab39b8a..8eb58c68 100644 --- a/weasyprint/layout/preferred.py +++ b/weasyprint/layout/preferred.py @@ -470,7 +470,10 @@ def table_and_columns_preferred_widths(context, box, outer=True): other_columns_contributions_sum = sum( other_columns_contributions) if other_columns_contributions_sum == 0: - ratio = 1 / len(other_columns_contributions) + if other_columns_contributions: + ratio = 1 / len(other_columns_contributions) + else: + ratio = 1 else: ratio = ( max_content_widths[i] /