Css 我无法更改引导模板的背景颜色
------------我为我的asp.net核心标识项目实现了引导SB管理模板。现在我正在对它进行个性化设置。问题是我无法更改模板的背景颜色,也无法更改导航菜单的颜色。当我检查元素时,颜色正在改变,但当我重写或删除style.css文件上的代码时,它不起作用。这是我登录页面的代码------------ @模型逻辑模型Css 我无法更改引导模板的背景颜色,css,asp.net-core,background-color,asp.net-core-identity,Css,Asp.net Core,Background Color,Asp.net Core Identity,------------我为我的asp.net核心标识项目实现了引导SB管理模板。现在我正在对它进行个性化设置。问题是我无法更改模板的背景颜色,也无法更改导航菜单的颜色。当我检查元素时,颜色正在改变,但当我重写或删除style.css文件上的代码时,它不起作用。这是我登录页面的代码------------ @模型逻辑模型 <head> <meta charset="utf-8" /> <meta http-equiv="
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Login</title>
<link href="css/styles.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/js/all.min.js" crossorigin="anonymous"></script>
</head>
<body class="login">
<div id="layoutAuthentication">
<div id="layoutAuthentication_content">
<main>
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-5">
<div class="card shadow-lg border-0 rounded-lg mt-5">
<div class="card-header"><h3 class="text-center font-weight-light my-4">Login</h3></div>
<div class="card-body">
<form id="account" method="post">
<h4 class="text-center">Use a local account to log in.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.UserName"></label>
<input asp-for="Input.UserName" class="form-control" />
<span asp-validation-for="Input.UserName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Input.Password"></label>
<input asp-for="Input.Password" class="form-control" />
<span asp-validation-for="Input.Password" class="text-danger"></span>
</div>
<div class="form-group">
<div class="checkbox">
<label asp-for="Input.RememberMe">
<input asp-for="Input.RememberMe" />
@Html.DisplayNameFor(m => m.Input.RememberMe)
</label>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">Log in</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="js/scripts.js"></script>
</body>
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
@charset "UTF-8";
/*!
* Start Bootstrap - SB Admin v6.0.2 (https://startbootstrap.com/template/sb-admin)
* Copyright 2013-2020 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-sb-admin/blob/master/LICENSE)
*/
/*!
* Bootstrap v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors
* Copyright 2011-2020 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
:root {
--blue: #007bff;
--indigo: #6610f2;
--purple: #6f42c1;
--pink: #e83e8c;
--red: #dc3545;
--orange: #fd7e14;
--yellow: #ffc107;
--green: #28a745;
--teal: #20c997;
--cyan: #17a2b8;
--white: #fff;
--gray: #6c757d;
--gray-dark: #343a40;
--primary: #007bff;
--secondary: #6c757d;
--success: #28a745;
--info: #17a2b8;
--warning: #ffc107;
--danger: #dc3545;
--light: #f8f9fa;
--dark: #343a40;
--breakpoint-xs: 0;
--breakpoint-sm: 576px;
--breakpoint-md: 768px;
--breakpoint-lg: 992px;
--breakpoint-xl: 1200px;
--font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
font-family: sans-serif;
line-height: 1.15;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
text-align: left;
background-color: #fff;
}
.bg-primary {
background-color: #007bff !important;
登录
登录
使用本地帐户登录。
@DisplayNameFor(m=>m.Input.RememberMe)
登录
@节脚本{
}
@字符集“UTF-8”;
/*!
*启动引导-SB Admin v6.0.2(https://startbootstrap.com/template/sb-admin)
*版权所有2013-2020启动引导
*麻省理工学院授权(https://github.com/StartBootstrap/startbootstrap-sb-admin/blob/master/LICENSE)
*/
/*!
*引导程序v4.5.3(https://getbootstrap.com/)
*版权所有2011-2020引导程序作者
*版权所有2011-2020推特公司。
*麻省理工学院授权(https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
:根{
--蓝色:#007bff;
--靛蓝:#6610f2;
--紫色:#6f42c1;
--粉红色:#e83e8c;
--红色:#dc3545;
--橙色:#fd7e14;
--黄色:#ffc107;
--绿色:#28a745;
--teal:#20c997;
--青色:#17a2b8;
--白色:#fff;
--灰色:#6c757d;
--灰黑色:#343a40;
--初级:#007bff;
--二级:#6c757d;
--成功:28a745;
--资料:#17a2b8 ;;
--警告:#ffc107;
--危险:#dc3545;
--灯光#f8f9fa;
--深色:#343a40;
--断点xs:0;
--断点sm:576px;
--断点md:768px;
--断点lg:992px;
--断点xl:1200px;
--字体系列无衬线:-苹果系统、BlinkMacSystemFont、“Segoe UI”、Roboto、“Helvetica Neue”、Arial、“Noto sans”、无衬线、“苹果颜色表情”、“Segoe UI表情”、“Segoe UI符号”、“Noto颜色表情符号”;
--字体系列monospace:SFMono-Regular、Menlo、摩纳哥、Consolas、“解放Mono”、“信使新”、monospace;
}
*,
*::之前,
*::之后{
框大小:边框框;
}
html{
字体系列:无衬线;
线高:1.15;
-webkit文本大小调整:100%;
-webkit点击高亮显示颜色:rgba(0,0,0,0);
}
文章、旁白、图表、页脚、页眉、hgroup、main、nav、章节{
显示:块;
}
身体{
保证金:0;
字体系列:-苹果系统,BlinkMacSystemFont,“Segoe UI”,Roboto,“Helvetica Neue”,Arial,“Noto Sans”,Sans serif,“苹果颜色表情符号”,“Segoe UI表情符号”,“Segoe UI符号”,“Noto颜色表情符号”;
字号:1rem;
字体大小:400;
线高:1.5;
颜色:#212529;
文本对齐:左对齐;
背景色:#fff;
}
.bg小学{
背景色:#007bff!重要;
}看起来Boorstrap的特定性高于您声明的样式。因此,您可以选择或使用
!重要信息
。增加特异性是更好的方法。但是,让我展示如何使用重写类!重要信息
:
.container {
background-color: lightgreen !important;
}
我们通过添加div
颜色可以在这里看到一个示例
我试过了,但还是不行。即使我直接在.bg primary{background color:#007bff!important;}@YoungDeveloper中更改颜色代码,颜色也不会改变。请仔细检查您是否只有一个
style.css
文件。也许你还有另一个.css
文件@YoungDeveloper可以自由提问。如果回复对您有帮助,您可以将其标记为答案,以简化其他用户将来的搜索。我发现的主题sorf继承了datatables.min.css的.css规则。有趣的是,这个文件只能从检查器中看到。在这个文件中,它写着:要用包含的*软件的最新版本重建或修改这个文件,请访问:**我非常困惑,对吗now@YoungDeveloper在ASP.NET创建捆绑包时,默认情况下可以使用此文件。应该有这样的script
标记
。在中查看更多信息
.container {
background-color: lightgreen !important;
}