【发布时间】:2016-08-06 18:19:55
【问题描述】:
.net 框架、mvc 和 Visual Studio 的新手,所以这可能是一个简单的问题。无论出于何种原因,尽管经过数小时的反复试验,当使用使用新 MVC 应用程序创建的默认布局时,我仍无法让我的视图占据整个页面。
我尝试了各种 css 技巧来将元素扩展至 100% 的高度,但没有得到这样的运气。有没有办法使用引导程序来做到这一点?如果没有,关于如何在不影响引导程序的情况下执行此操作的任何建议?
通过实现“行”类,我已经能够获得跨越整个页面的宽度。这其中的高度部分仍然难以捉摸。
_layout.cshtml
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0">
<title>@ViewBag.Title - Crestwood Weather</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Crestwood Weather Viewer", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home") </li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<div class="container-fluid body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Crestwood Midstream Partners LP</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
视图的 HTML 和 Body 似乎仅限于布局中的某些内容,将其限制为页面高度的一半。即使在处理 HTML 和 Body 标签时,内容仍然显示如下。
示例
【问题讨论】:
标签: asp.net-mvc twitter-bootstrap css