diff --git a/weasyprint/layout/table.py b/weasyprint/layout/table.py index 2a8992c83..6b7f29aa5 100644 --- a/weasyprint/layout/table.py +++ b/weasyprint/layout/table.py @@ -289,10 +289,14 @@ def group_layout(group, position_y, bottom_space, page_is_empty, skip_stack): cell.computed_height - cell.content_height) if vertical_align_shift > 0: for child in cell.children: - child_shift = child.margin_height() - if cell.vertical_align == 'middle': - child_shift /= 2 - child.translate(dy=vertical_align_shift - child_shift) + if child.is_in_normal_flow(): + child.translate(dy=vertical_align_shift) + else: + # Out-of-flow children are not in cell.content_height. + child_shift = child.margin_height() + if cell.vertical_align == 'middle': + child_shift /= 2 + child.translate(dy=vertical_align_shift - child_shift) next_position_y = row.position_y + row.height if resume_at is None: