It's .NET6 razor pages project and I use VS2022.
This is in _Layout.cshtml.
<ul class="list-unstyled ml-2">
<li>
<a href="/TEST">TEST</a>
<a asp-page="TEST/Index">TEST1</a>
</li>
...
There are 2 anchor tag in nav bar but css in _Layout.cshtml.css is not applied to one with asp-page tag due to no attribute "b-l76pcumf24"

Could anyone explain why and how to make it work with asp-page tag helper?
Thanks
CSS isolation is a build time feature. Tag helper output is generated at runtime, so they cannot support the CSS isolation feature. This is by design.
Set your own href attribute, like in your first link, and don't apply any custom asp-* attributes to the anchor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With