at (8,8) content-size 14.265625x17.46875 flex-item [BFC] children: inline
+ line 0 width: 14.265625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 1, rect: [8,8 14.265625x17.46875]
+ "A"
+ TextNode <#text>
diff --git a/Tests/LibWeb/Layout/input/flex/justify-content-space-between-single-item.html b/Tests/LibWeb/Layout/input/flex/justify-content-space-between-single-item.html
new file mode 100644
index 0000000000..90ff2b325f
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/flex/justify-content-space-between-single-item.html
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index 9dd82fe210..cd7d058b02 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -1331,7 +1331,8 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
} else {
initial_offset = 0;
}
- space_between_items = flex_line.remaining_free_space / (number_of_items - 1);
+ if (number_of_items > 1)
+ space_between_items = flex_line.remaining_free_space / (number_of_items - 1);
break;
case CSS::JustifyContent::SpaceAround:
space_between_items = flex_line.remaining_free_space / number_of_items;