【发布时间】:2018-12-06 02:09:24
【问题描述】:
如何在 MVC 中的 html 标记上设置(不做可怕的 hack)lang 属性
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
</html>
在 Forms 3.5 中,这可以通过将 runat='server' 添加到 html 标记然后设置值来完成。
我找不到这样做的“首选”方式。
我打算将它与css:lang 选择器一起使用
【问题讨论】:
-
这取决于您使用的 MVC 框架。
-
请不要使用 w3schools 作为参考。 It is a horrible site that contains lots of invalid information.
-
如果您使用的是 ASP.NET MVC,您可以直接在 _Layout 视图或您用作母版页的任何地方编辑标签。
-
如果您使用的是 ASP.NET MVC,请阅读the description of the mvc tag。
-
答案应该作为答案发布,而不是通过编辑问题。
标签: html asp.net-mvc lang