[英]ASP.NET MVC _Layout.cs is removing my divs?
<div class="left-sidebar">
<ul>
<li>@Html.ActionLink("Guild", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })</li>
@*<li>@Html.ActionLink("A", "A", "Home")</li>*@
<li>@Html.ActionLink("B", "B", "Home")</li>
<li>@Html.ActionLink("C", "C", "Home")</li>
<li>@Html.ActionLink("D", "D", "Home")</li>
</ul>
</div>
<div class="main-content">
@RenderBody()
<hr />
</div>
<div class="clear" /> // This goes missing on output?!
I have a left-sidebar and an main content, I'm using css to make the two divs float side by side. 我有一个左侧栏和一个主要内容,我使用CSS使两个div并排浮动。 I need the "Clear" so the footer doesn't hover over the divs.
我需要“清除”,以便页脚不会悬停在div上。
However, when I run the website the preview my Clear divs are gone in the _Layout.cs BUT if I have them in my @RenderBody they appear as they should. 但是,当我运行网站时,如果我将它们放在@RenderBody中,则我的Clear div的预览将消失在_Layout.cs中,但它们将按原样显示。
div
is not allowed to omit the closing element so the form <div />
is invalid. div
不允许省略close元素,因此<div />
格式无效。 Put it as <div class="clear"></div>
instead and check. 改为
<div class="clear"></div>
并进行检查。
From documentation about div element : 从有关div元素的文档中 :
Tag omission: None, both the starting and ending tag are mandatory.
标签遗漏:无,开始标签和结束标签都是必需的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.