Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor not generating matching scoped CSS selector in html markup of compiled razor page

$
0
0

My Blazor build (ASP.NET Core 9.0, VS 2022) is correctly generating the scoped selectors for isolated CSS:

Program.cs:

builder.WebHost.UseStaticWebAssets();

App.razor<head> tag:

<link rel="stylesheet" href="MyAssemblyName.styles.css" />

MainLayout.razor:

<AppBar class="test-class"></AppBar>

The AppBar.razor.css part compiled into MyAssemblyName.styles.css:

.test-class[b-rx6ij8vkro] {    color: red;    background-color: aquamarine;}

So far so good, I have the b-rx6ij8vkro selector. However, here's the generated html:

<header class="mud-appbar mud-appbar-fixed-top mud-elevation-0 test-class">

No b-rx6ij8vkro selector on the header tag. Moreover, no selectors are generated for any other tags in the html file!

How do I generate the correct html?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>