我不知道为什么我无法在我的MVC网站上使用bootstrap。我正在使用VS2012,C#,MVC。如果我像这样引用bootstrap
<head>
<title>Bootstrap Case</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@ViewBag.Title</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
Bootstrap Works。
但是如果我下载这些文件并像这样引用它们就不会:
<head>
<title>Bootstrap Case</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@ViewBag.Title</title>
@Scripts.Render("~/bundles/jquery")
@Styles.Render("~/Content/bootstrapcss")
@Scripts.Render("~/bundles/bootstrapjs")
</head>
我的BundleConfig
看起来像是:
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.IgnoreList.Clear();
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/bootstrapjs").Include(
"~/Scripts/bootstrap.min.js"));
bundles.Add(new StyleBundle("~/Content/bootstrapcss").Include(
"~/Content/bootstrap.min.css",
"~/Content/bootstrap-responsive.min.css"));
}
}
我做错了什么?
[解决]
mmcrae coment中的解决方案为我工作。我不能投票。
bundles.Add(new StyleBundle("~/Content/bootstrap").Include( "~/Content/bootstrap.css", "~/Content/bootstrap-theme.css"));
insted of
bundles.Add(new StyleBundle("~/Content/bootstrapcss").Include( "~/Content/bootstrap.min.css", "~/Content/bootstrap-responsive.min.css"));