我能做什么“bootstrap / less / bootstrap.less”不会覆盖我所有的css -styles(我只能使用我只需要的.less文件(例如:bootstrap / less / buttons.less),但是我需要所有课程)。 当我导入“bootstrap / less / bootstrap.less”时,它将覆盖我的引导菜单和所有标准选择器,如input,textarea ......,但我只想覆盖我想要的css类,但不是所有的...... 谢谢:))
[更新时间:09-04-2014]
我的项目的背景信息: 重要的NuGet包装:
Visual Studio 2013
我的“Site.less”看起来像
/*@import "bootstrap/less/buttons.less";*/
@import "bootstrap/less/bootstrap.less";
.BWButton {
.btn;
}
当我只导入“bootstrap / less / bootstrap.less”时,它有点奇怪,everthing将被覆盖,无论我在主页中进行的css / less导入的顺序和时间都无关紧要我只使用“@import”bootstrap / less / buttons.less“”对页面没有任何影响,即使我删除了母版页中的所有css / less导入...但智能感适用于两个导入(“bootstrap /” less / buttons.less“和”bootstrap / less / bootstrap.less“)(当在site.less中导入时),但在客户端站点Site.less上(当我导入”bootstrap / less / buttons.less“之前) site.less)是空的(当我在火虫中选择“Site.less”时)..
我的master.page(Shared / _Layout.cshtml)在标题中查找如下:
@Scripts.Render("~/bundles/modernizr")
@Styles.Render("~/Content/dataTable.css")
@Styles.Render("~/Content/popup.css")
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
@Styles.Render("~/Content/Site.less")
@Styles.Render("~/Content/bootstrap.css")
@Styles.Render("~/Content/site.css")
客户端的输出:
<script src="/speScripts/modernizr-2.6.2.js">
<link rel="stylesheet" href="/Content/dataTable.css">
<link rel="stylesheet" href="/Content/popup.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<link rel="stylesheet" href="/Content/Site.less">
<link rel="stylesheet" href="/Content/bootstrap.css">
<link rel="stylesheet" href="/Content/site.css">
这可能会对你有所帮助:)
答案 0 :(得分:2)
在你的HTML中,请确保最后包含自己的样式表!
<head>
<link href="includes/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="includes/css/style.css" rel="stylesheet">
</head>
在上面的示例中,我的自定义样式表将否决bootstrap.min.css表。