diff --git a/tests/layout/test_flex.py b/tests/layout/test_flex.py
index f1a6154e7..8ca761444 100644
--- a/tests/layout/test_flex.py
+++ b/tests/layout/test_flex.py
@@ -545,3 +545,21 @@ def test_flex_absolute():
''')
+
+
+@assert_no_logs
+def test_flex_percent_height():
+ page, = render_pages('''
+
+ ''')
+ html, = page.children
+ body, = html.children
+ a, = body.children
+ b, = a.children
+ assert a.height == 10
+ assert b.height == 1
diff --git a/weasyprint/layout/flex.py b/weasyprint/layout/flex.py
index 540d55af5..330538cfd 100644
--- a/weasyprint/layout/flex.py
+++ b/weasyprint/layout/flex.py
@@ -241,7 +241,10 @@ def flex_layout(context, box, bottom_space, skip_stack, containing_block,
block.block_level_width(box, containing_block)
else:
if box.style['height'] != 'auto':
- box.height = box.style['height'].value
+ if box.style['height'].unit == '%':
+ box.height = box.style['height'].value / 100. * containing_block.height
+ else:
+ box.height = box.style['height'].value
else:
box.height = 0
for i, child in enumerate(children):