Css 更改ASP.NET MVC中的引导主题显示问题
我有一个MVC项目,我已经将默认引导主题更改为Bootswatch-Cosmos,但是它给了我附加的导航栏结果 最初我运行的是Bootstrap3.0,并使用Bootswatch3.0来确保没有版本冲突 我已采取以下步骤:Css 更改ASP.NET MVC中的引导主题显示问题,css,asp.net,asp.net-mvc,twitter-bootstrap,bootstrap-4,Css,Asp.net,Asp.net Mvc,Twitter Bootstrap,Bootstrap 4,我有一个MVC项目,我已经将默认引导主题更改为Bootswatch-Cosmos,但是它给了我附加的导航栏结果 最初我运行的是Bootstrap3.0,并使用Bootswatch3.0来确保没有版本冲突 我已采取以下步骤: 将cosmos-boostrap.css和cosmos-boostrap.min.css添加到内容文件夹 参考my BundleConfig.cs中的css文件: bundles.Add(new StyleBundle("~/Content/css").Include
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/cosmos-bootstrap.css",
"~/Content/site.css"));
@Styles.Render("~/Content/css")
<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("Portal", "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>© @DateTime.Now.Year - TEST IT SOLUTIONS</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
@ActionLink(“门户”、“索引”、“主页”、新的{area=”“}、新的{@class=“navbar品牌”})
- @ActionLink(“主页”、“索引”、“主页”)
- @ActionLink(“关于”、“关于”、“主页”)
- @ActionLink(“联系人”、“联系人”、“主页”)
@Html.Partial(“_LoginPartial”)
@RenderBody()
&抄袭@DateTime.Now.Year-测试IT解决方案
@Scripts.Render(“~/bundles/jquery”)
@Scripts.Render(“~/bundles/bootstrap”)
@RenderSection(“脚本”,必需:false)
引导程序4几乎是对引导程序3的完全重写,因此,两个版本之间完全不兼容
因此,为引导3设计的引导主题必须手动迁移到引导4。因为两个版本如此不同,所以没有简单或自动化的方法来实现。任何自动化迁移的尝试都会留下大量需要手动调整的内容
另外,如果您只想修复标题,请发布您问题中的完整的代码片段
(HTML输出),即在此处发布您当前的代码
编辑:
根据您现在发布的代码片段,有一点很清楚:您的主题不是Bootstrap4主题,并且与Bootstrap4不兼容。你所拥有的是Bootstrap3代码
下面是特定导航栏的Bootstrap 4代码的外观(您需要根据需要调整ASP.NET代码的外观;单击下面的“运行代码片段”按钮查看它的实际操作):
-
-
-
-
-
您好
,谢谢。升级到BS4后,我使用了一个全新的BS4兼容主题,所以我认为这不是问题所在。将编辑我的帖子来显示HTML。不,那里的代码肯定不是Bootstrap4。这是引导程序3。无论谁把它作为“B4兼容主题”出售,都试图欺骗你。刚刚用导航栏的引导4代码更新了我的答案。您需要根据需要调整ASP.NET,但我的代码片段为您提供了一个与当前引导3导航栏具有相同属性/功能的工作引导4导航栏。