diff --git a/Tests/LibWeb/Text/expected/css/hsl-with-number-percentage-calc.txt b/Tests/LibWeb/Text/expected/css/hsl-with-number-percentage-calc.txt
new file mode 100644
index 00000000000..0f939ec099e
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/css/hsl-with-number-percentage-calc.txt
@@ -0,0 +1 @@
+rgb(88, 101, 242)
diff --git a/Tests/LibWeb/Text/input/css/hsl-with-number-percentage-calc.html b/Tests/LibWeb/Text/input/css/hsl-with-number-percentage-calc.html
new file mode 100644
index 00000000000..a34a170a876
--- /dev/null
+++ b/Tests/LibWeb/Text/input/css/hsl-with-number-percentage-calc.html
@@ -0,0 +1,13 @@
+
+
+
+
Hello
+
diff --git a/Userland/Libraries/LibWeb/CSS/CSSNumericType.cpp b/Userland/Libraries/LibWeb/CSS/CSSNumericType.cpp
index 0b52fecff40..53e603ae4c2 100644
--- a/Userland/Libraries/LibWeb/CSS/CSSNumericType.cpp
+++ b/Userland/Libraries/LibWeb/CSS/CSSNumericType.cpp
@@ -350,7 +350,7 @@ bool CSSNumericType::matches_percentage() const
auto base_type = static_cast(i);
auto type_exponent = exponent(base_type);
if (base_type == BaseType::Percent) {
- if (!type_exponent.has_value() || type_exponent == 0)
+ if (type_exponent != 1)
return false;
} else {
if (type_exponent.has_value() && type_exponent != 0)
@@ -409,8 +409,9 @@ bool CSSNumericType::matches_number_percentage() const
auto base_type = static_cast(i);
auto type_exponent = exponent(base_type);
- if (base_type == BaseType::Percent && type_exponent.has_value() && type_exponent != 0 && type_exponent != 1) {
- return false;
+ if (base_type == BaseType::Percent) {
+ if (type_exponent.has_value() && type_exponent != 0 && type_exponent != 1)
+ return false;
} else if (type_exponent.has_value() && type_exponent != 0) {
return false;
}