为什么Visual Studio会在新的ASPX页面中放置div标签?

时间:2022-12-25 02:46:42

By default, a new ASPX page contains the following:

默认情况下,新的ASPX页面包含以下内容:

<body>
    <form id="form1" runat="server">
    <div>


    </div>
    </form>
</body>

I'm curious--is there any reason I should leave that div tag in?

我很好奇 - 有什么理由我应该留下那个div标签吗?

5 个解决方案

#1


There's no real point, but I don't think it's standards-compliant to write text straight after a <form> tag, but it would be inside a <div>. Feel free to delete it though.

没有真正的意义,但我不认为在

标签之后直接写文本符合标准,但它会在
中。尽管如此,请随意将其删除。

#2


To put things in it? It's not necessary, but it prevents you from having to create a div tag when starting out your web layout.

把东西放进去吗?这没有必要,但它可以防止您在开始Web布局时创建div标签。

#3


Why? Because said DIV is part of the template. No, it doesn't matter and you can feel free to get rid of it.

为什么?因为所说的DIV是模板的一部分。不,这没关系,你可以随意摆脱它。

#4


Maybe they are subtly encouraging designers to shed the <TABLE> mentality and move to <DIV>s. ;-)

也许他们巧妙地鼓励设计师摆脱

。 ;-)

心态并转向

#5


If you don't like it, you can always edit the default template to remove them permanently:

如果您不喜欢它,您可以随时编辑默认模板以永久删除它们:

C:\Program Files\Microsoft Visual Studio 9.0\Web\WebNewFileItems\CSharp\WebForm.aspx

C:\ Program Files \ Microsoft Visual Studio 9.0 \ Web \ WebNewFileItems \ CSharp \ WebForm.aspx

C:\Program Files\Microsoft Visual Studio 9.0\Web\WebNewFileItems\VB\WebForm.aspx

C:\ Program Files \ Microsoft Visual Studio 9.0 \ Web \ WebNewFileItems \ VB \ WebForm.aspx

Just remove the <div> </div> tags from the relevant one of these for your projects.

只需从项目中相关的一个中删除

标记即可。

#1


There's no real point, but I don't think it's standards-compliant to write text straight after a <form> tag, but it would be inside a <div>. Feel free to delete it though.

没有真正的意义,但我不认为在

标签之后直接写文本符合标准,但它会在
中。尽管如此,请随意将其删除。

#2


To put things in it? It's not necessary, but it prevents you from having to create a div tag when starting out your web layout.

把东西放进去吗?这没有必要,但它可以防止您在开始Web布局时创建div标签。

#3


Why? Because said DIV is part of the template. No, it doesn't matter and you can feel free to get rid of it.

为什么?因为所说的DIV是模板的一部分。不,这没关系,你可以随意摆脱它。

#4


Maybe they are subtly encouraging designers to shed the <TABLE> mentality and move to <DIV>s. ;-)

也许他们巧妙地鼓励设计师摆脱

。 ;-)

心态并转向

#5


If you don't like it, you can always edit the default template to remove them permanently:

如果您不喜欢它,您可以随时编辑默认模板以永久删除它们:

C:\Program Files\Microsoft Visual Studio 9.0\Web\WebNewFileItems\CSharp\WebForm.aspx

C:\ Program Files \ Microsoft Visual Studio 9.0 \ Web \ WebNewFileItems \ CSharp \ WebForm.aspx

C:\Program Files\Microsoft Visual Studio 9.0\Web\WebNewFileItems\VB\WebForm.aspx

C:\ Program Files \ Microsoft Visual Studio 9.0 \ Web \ WebNewFileItems \ VB \ WebForm.aspx

Just remove the <div> </div> tags from the relevant one of these for your projects.

只需从项目中相关的一个中删除

标记即可。