样式表未正确使用

时间:2014-04-17 13:51:44

标签: css asp.net-mvc-4 twitter-bootstrap layout

我正在使用Twitter的Bootstrap框架来创建一个新的ASP.NET(MVC)应用程序。一切都很好,但我的Site.css文件没有正确使用有问题。我已经认识到这个.css文件导致我的navbar在顶部有太大的余量:

enter image description here

违规项目是Chrome对话框中突出显示的50px。我查看了我的Style.css,body padding-top 确实是 50px。

body {
    padding-top: 50px;
    padding-bottom: 20px;
}

所以我将其更改为

body {
    padding-top: 20px;
    padding-bottom: 20px;
}

但问题仍然存在,当我检查项目时,它仍然在Chrome对话框中的Site.css中显示50px。 如何更新Style.css以便更改仍然存在?


_Layout.cshtml文件的代码是:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>
        @String.Format("{0} - {1}", 
            ViewBag.Title, 
            VisasysNET.Utilities.Constants.Visasys)
    </title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body>
    <div class="container">
        <div class="navbar navbar-default" role="navigation">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button"
                            class="navbar-toggle"
                            data-toggle="collapse"
                            data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    @Html.ActionLink(VisasysNET.Utilities.Constants.Visasys,
                        "Index", "Home", null, new { @class = "navbar-brand" })
                </div>
                <div class="navbar-collapse collapse">
                    <ul class="nav navbar-nav">
                        <li class="active">@Html.ActionLink("Home", "Index", "Home")</li>
                        <li>@Html.ActionLink("Consultancy", "Index", "Consultancy")</li>
                        <li>@Html.ActionLink("Products", "Index", "Products")</li>
                        <li>@Html.ActionLink("Our Clients", "Index", "OurClients")</li>
                        <li>@Html.ActionLink("About", "About", "Home")</li>
                        <li>@Html.ActionLink("Contacts", "Index", "Contacts")</li>
                    </ul>
                    @Html.Partial("_LoginPartial")
                </div>
            </div> <!--container-fluid-->
        </div> <!--navbar-->
        @RenderBody()
        <hr />
        <footer>
            <p>
                &copy;
                @String.Format("{0} - {1}",
                    DateTime.Now.Year,
                    VisasysNET.Utilities.Constants.Visasys)
            </p>
        </footer>
        @*</div>*@
        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/bootstrap")
        @RenderSection("scripts", required: false)

    </div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

听起来像是一个缓存问题。按住CTRL键并在浏览器中按F5键。