我真的很新的ASP.NET。我只是检出一个默认的ASP.NET Web应用程序。它默认带有几页(Default.aspx,About.aspx等)。
我注意到Site.master文件是我为我的页面创建主布局的文件。
但我也注意到head标签有一个runat =“server”属性。
我知道这个标签用于< asp:XXX>标签,但是为什么在< head>标签???
此外,当我删除该属性,那么所有的样式都从网页。所以显然它做了一些事情。我只是不明白它的确在做什么…
那么为什么它在那里,在一个HTML标签… ???我没有看到任何代码,应该在服务器上运行…
- <head runat="server">
- <title>Hallo</title>
- <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
- <!-- This part is run on the server. So why does the head tag
- also need a runat=server ?? -->
- <asp:ContentPlaceHolder ID="HeadContent" runat="server">
- </asp:ContentPlaceHolder>
- </head>