Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 我的页脚,更改为“父”_Html_Css_Model View Controller_Footer - Fatal编程技术网

Html 我的页脚,更改为“父”

Html 我的页脚,更改为“父”,html,css,model-view-controller,footer,Html,Css,Model View Controller,Footer,我有一个mvc项目,其中有一个布局页面,包含页眉、RenderBody()和页脚以及一些脚本。像这样: <body class="main"> <div class="header">...</div> @RenderBody() <div class="footer">...</div> </body> ... @RenderBody() ... 我有一个包含两个部分的页面。像这样: @model Ent

我有一个mvc项目,其中有一个布局页面,包含页眉、RenderBody()和页脚以及一些脚本。像这样:

<body class="main">
  <div class="header">...</div>
  @RenderBody()
  <div class="footer">...</div>
</body>

...
@RenderBody()
...
我有一个包含两个部分的页面。像这样:

@model Entity.Models.Photo
@{
   Layout = "~/Views/Shared/_mainLayout.cshtml";
 }
<div class="upPage">

   <div id="upPhoto">
      @Html.Partial("~/Views/_upPhotoContainer.cshtml", Model)
   </div>

   @Html.Partial("~/Views/_uploadBox.cshtml")
</div>
@model Entity.Models.Photo
@{
Layout=“~/Views/Shared/\u mainLayout.cshtml”;
}
@Html.Partial(“~/Views/\u upPhotoContainer.cshtml”,模型)
@Html.Partial(“~/Views/\u uploadBox.cshtml”)

问题是,当我运行项目时,在浏览器中,页脚部分将成为类为“upPage”的div的子部分。但它在布局页面中,与此页面无关。我找不到CSS或我的代码有任何问题。这快把我逼疯了。我做了很多事情,但没有一件是有效的…

如果你确信你所包含的所有东西都正确地关闭了,那么我只能使用clearfix来考虑这一点,它通常帮助我在通过PHP添加元素时处理放错位置的元素。也许对你也有帮助:

@model Entity.Models.Photo
@{
   Layout = "~/Views/Shared/_mainLayout.cshtml";
 }
<div class="upPage">

   <div id="upPhoto">
      @Html.Partial("~/Views/_upPhotoContainer.cshtml", Model)
   </div>

   @Html.Partial("~/Views/_uploadBox.cshtml")

   <!-- HERE -->
   <div class="clear"></div>
</div>

输出页面中的
是否为每个
添加一个?从这里我可以看到,你包括的东西可能没有关闭它打开的所有div,因为这会导致这个。非常感谢你的回答。我又检查了一遍,收尾没有什么问题。”Clearfix解决了我的问题…:)哦,我想那是一个DOM儿童,而不是视觉儿童。哈哈,我误会了,他安克斯。。。它起作用了。。。这真是一个疯狂的问题。再次感谢:)
  .clear{
      clear: both;
      height: 0px;
   }