diff --git a/Tests/LibWeb/Layout/expected/font-size-zero.txt b/Tests/LibWeb/Layout/expected/font-size-zero.txt
new file mode 100644
index 0000000000..c3c51f660b
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/font-size-zero.txt
@@ -0,0 +1,14 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+ BlockContainer at (0,0) content-size 800x16 [BFC] children: not-inline
+ BlockContainer
at (8,8) content-size 784x0 children: not-inline
+ BlockContainer at (8,8) content-size 784x0 children: inline
+ line 0 width: 0, height: 0, bottom: 0, baseline: 0
+ frag 0 from TextNode start: 0, length: 21, rect: [8,8 0x0]
+ "should not be visible"
+ TextNode <#text>
+
+ViewportPaintable (Viewport<#document>) [0,0 800x600]
+ PaintableWithLines (BlockContainer) [0,0 800x16]
+ PaintableWithLines (BlockContainer) [8,8 784x0]
+ PaintableWithLines (BlockContainer
) [8,8 784x0]
+ TextPaintable (TextNode<#text>)
diff --git a/Tests/LibWeb/Layout/input/font-size-zero.html b/Tests/LibWeb/Layout/input/font-size-zero.html
new file mode 100644
index 0000000000..4a0aba6ab5
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/font-size-zero.html
@@ -0,0 +1,5 @@
+
should not be visible
diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
index f65f4a66c2..2ac2ccebb5 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
@@ -2223,8 +2223,7 @@ RefPtr StyleComputer::compute_font_for_style_values(DOM::Elemen
}
if (maybe_length.has_value()) {
auto px = maybe_length.value().to_px(length_resolution_context).to_int();
- if (px != 0)
- font_size_in_px = px;
+ font_size_in_px = px;
}
}