我已经做了一个。net 6 web应用。
我刚刚在服务器上发布了这个站点:
但是突然注意到一些a属性的样式发生了变化。
例如页脚要大得多:
我检查了chrome devTools,似乎有一个数字添加到属性:
我的本地页脚属性看起来像:
<footer class="bg-dark footer text-muted mt-auto">
<div class="container text-center">
© 2022 - LTPWeb - Support: <a href="mailto:test@gmail.com">test@gmail.com</a>
</div>
</footer>
,但在服务器上,footer属性看起来像:
<footer b-jthj6vf6tt="" class="bg-dark footer text-muted mt-auto">
<div b-jthj6vf6tt="" class="container text-center">
© 2022 - LTPWeb - Support: <a b-jthj6vf6tt="" href="mailto:test@gmail.com">test@gmail.com</a>
</div>
</footer>
突然这段代码b-jthj6vf6tt添加:如果我删除这些代码,样式是正常的。
这只是一个bug还是我做错了什么?
该属性是作为。net 6中新增的CSS隔离特性的一部分注入的:https://www.mikesdotnetting.com/article/355/css-isolation-in-razor-pages
要选择退出此功能,请将您想要保留的样式从_Layout.cshtml.css文件(在Shared文件夹中-它可能嵌套在VS Solution Explorer中)移动到wwwroot/css/site.js文件中,并删除_Layout.cshtml.css文件。然后删除Layout的head
中的link
元素。cshtml文件引用[YourAppName].styles.css.