我正在asp.net MVC中构建一个Web应用程序。我的引导导航栏昨天工作得很好。当我在调试中运行时,没有错误。布局上没有更改代码。我最近尝试了一个href到bootstrap repo没有运气。我没有要求你调试我的代码,因为它们不应该是任何错误。为什么会发生这种情况?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Employee Portal</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
<!--================== NAVBAR ===================-->
<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("Employee Portal", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Add Employee", "Create", "Employees")</li>
<li>@Html.ActionLink("All Employees", "Index", "Employees")</li>
<li>@Html.ActionLink("All Positions", "Index", "Positions")</li>
<li>@Html.ActionLink("All Departments", "Index", "Departments")</li>
<li>@Html.ActionLink("Reports", "Reports", "Home")</li>
<li>@Html.ActionLink("Employee Activity", "Index", "ChangeLogs")</li>
</ul>
</div>
</div>
</div> <!-- End NAVBAR-->
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Conservice</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
<script src="~/Scripts/bootstrap.js"></script>
</body>
</html>
答案 0 :(得分:0)
很可能,您的Nuget Bootstrap版本已更新。我还注意到你在布局文件中引用了Bootstrap 4.0 CDN。通过Nuget UI恢复到Bootstrap 3.x并更正CDN链接应该可以解决您的问题。
Bootstrap新版本4中的Navbar是一个重大改变。