我正在努力使MVC的开箱即用模板的内容部分在2015年达到屏幕宽度的100%。但我不知道该在哪里做。我试着增加宽度:在Site.css中100%的身体,但它没有工作。我还尝试将其添加到Site.css中的..body内容类中。另外,我将.Content添加到Site.css中,并添加了宽度:100%,但它不起作用。有什么想法吗?
虽然模板使用引导,但我不认为这是一个100%的引导问题。也许这是微软使用的默认模板?
发布于 2016-06-04 17:39:24
正如a comment在100% width Twitter Bootstrap 3 template中指出的那样,您可以使用container-fluid类来使宽度达到100%。
将container更改为_Layout.cshtml的第13和32行上的container-fluid,并按预期工作。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<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("Application name", "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 - My ASP.NET Application</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>https://stackoverflow.com/questions/37632571
复制相似问题