首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >.NET MVC 4 Visual 2015模板使内容宽度100%?

问.NET MVC 4 Visual 2015模板使内容宽度100%?
EN

Stack Overflow用户
提问于 2016-06-04 16:32:26
回答 1查看 2.5K关注 0票数 2

我正在努力使MVC的开箱即用模板的内容部分在2015年达到屏幕宽度的100%。但我不知道该在哪里做。我试着增加宽度:在Site.css中100%的身体,但它没有工作。我还尝试将其添加到Site.css中的..body内容类中。另外,我将.Content添加到Site.css中,并添加了宽度:100%,但它不起作用。有什么想法吗?

虽然模板使用引导,但我不认为这是一个100%的引导问题。也许这是微软使用的默认模板?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-04 17:39:24

正如a comment在100% width Twitter Bootstrap 3 template中指出的那样,您可以使用container-fluid类来使宽度达到100%。

将container更改为_Layout.cshtml的第13和32行上的container-fluid,并按预期工作。

代码语言:javascript
复制
<!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>&copy; @DateTime.Now.Year - My ASP.NET Application</p>
        </footer>
    </div>

    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)
</body>
</html>
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37632571

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档