Css 引导模板在MVC应用程序中不起作用

Css 引导模板在MVC应用程序中不起作用,css,asp.net-mvc,twitter-bootstrap,Css,Asp.net Mvc,Twitter Bootstrap,我正在尝试使用免费的引导模板从 . 我从这个站点复制了bootstrap.css和bootstrap.min.css并粘贴到我的应用程序中,但我的应用程序并不像这个模板那样显示导航栏。 请在此网站和我的主页上找到附加的屏幕截图 从本网站: 从我的申请中: My_Layout.cs: 非常感谢您的任何建议。谢谢。不要使用bundles.config和render脚本。只需下载bootstrap.min.css文件并将其复制到MVC项目中的一个文件夹中即可。在_layout.cshtml文件中,将

我正在尝试使用免费的引导模板从 . 我从这个站点复制了bootstrap.css和bootstrap.min.css并粘贴到我的应用程序中,但我的应用程序并不像这个模板那样显示导航栏。 请在此网站和我的主页上找到附加的屏幕截图

从本网站:

从我的申请中:

My_Layout.cs:


非常感谢您的任何建议。谢谢。

不要使用bundles.config和render脚本。只需下载bootstrap.min.css文件并将其复制到MVC项目中的一个文件夹中即可。在_layout.cshtml文件中,将该css文件拖放到标记中。它必须起作用。试试看。

在我的_Layout.cshtml文件中,我在标题部分给出了如下脚本和样式: @style.Render~/Content/css @Scripts.Render~/bundles/jquery @Scripts.Render~/bundles/jqueryval @Scripts.Render~/bundles/bootstrap @Scripts.Render~/bundles/modernizer @Scripts.Render~/bundles/Custom
您可能使用的引导版本与用于引导样例主题的引导版本不同。我也遇到了同样的问题,并在Github上发布了一个问题,Thomas Park给了我以下答案:

是的,只要确保你使用的是与引导程序相同的版本。现在v4在bootswatch.com上,但您可以在和上获取旧版本

因此,请尝试更新您的引导版本或使用您希望从上面的链接获得的引导样例主题的早期版本

来源:

可能存在的副本
<!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">
            <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 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>
 public class BundleConfig
    {
        // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/respond.js"));
            bundles.Add(new StyleBundle("~/Content/bootstrap").Include(
    "~/Content/bootstrap.css",
    "~/Content/bootstrap-theme.css"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css"));
        }
    }