From 92cdea776112dadd12dd6ccf125e166003d1b2f1 Mon Sep 17 00:00:00 2001 From: David Britch Date: Tue, 18 Feb 2025 09:24:08 +0000 Subject: [PATCH] CSS specificity is supported in .NET 9 SR4. --- docs/user-interface/styles/css.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/user-interface/styles/css.md b/docs/user-interface/styles/css.md index a0bb7e8fc..4ee24e64c 100644 --- a/docs/user-interface/styles/css.md +++ b/docs/user-interface/styles/css.md @@ -342,9 +342,19 @@ The following selectors are unsupported: - `@media` and `@supports` - `:` and `::` +::: moniker range="=net-maui-8.0" + > [!NOTE] > Specificity, and specificity overrides are unsupported. +::: moniker-end + +::: moniker range=">=net-maui-9.0" + +If two or more CSS rules point to the same element, the selector with the highest specificity will take precedence and its style declaration will be applied to the element. The [specificity algorithm](https://github.com/dotnet/maui/blob/main/src/Controls/src/Core/StyleSheets/Selector.cs#L319) calculates the weight of a CSS selector to determine which rule from competing CSS declarations gets applied to the element. + +::: moniker-end + ## Property reference The following CSS properties are supported by .NET MAUI (in the **Values** column, types are *italic*, while string literals are `gray`):