gpt4 book ai didi

html - ASP.Net MVC 控制标签栏

转载 作者:行者123 更新时间:2023-11-28 04:37:41 25 4
gpt4 key购买 nike

我创建了一个新的 asp.net MVC 元素并开始根据我的需要对其进行修改。我在控制标签栏的颜色时遇到问题。我将这些更改添加到 site.css 文件

 .navbar-inverse 
{ background-color: lightblue !important;


}
.nav.navbar-nav li a {
color: black !important;
font-weight: bold !important;

}

第一部分按照我的意愿更改了背景颜色。第二部分更改了除第一个选项卡(位于主页选项卡之前的选项卡)之外的文本颜色。同样对于确实发生变化的选项卡,我失去了悬停颜色。当我将鼠标悬停在它们上方时,它们会变成白色。现在只适用于第一个选项卡。

我想更改第一个选项卡的颜色并恢复所有选项卡的悬停颜色更改。

见附图。

Tab Bar

最佳答案

问题是您正在使用 !important 标志。

我建议您创建自己的自定义类,例如 .navbar-custom

改变:

<nav class="navbar navbar-inverse">

收件人:

<nav class="navbar navbar-custom">

下面是一个为您指明正确方向的示例:

/*Navbar styles*/

.navbar-custom {
background-color: lightblue;
}
/*Navbar brand styles*/

.navbar-custom .navbar-brand {
color: black;
}
/*Navbar brand hover styles*/

.navbar-custom .navbar-brand:hover,
.navbar-custom .navbar-brand:focus {
color: blue;
}
/*Navbar anchor styles*/

.navbar-custom .nav.navbar-nav li a {
color: black;
font-weight: bold;
}
/*Navbar anchor hover styles*/

.navbar-custom .nav>li>a:focus,
.navbar-custom .nav>li>a:hover {
background-color: #eee;
}
/* Mobile navbar toggle styles*/

.navbar-custom .navbar-toggle {
border-color: #333;
}
.navbar-custom .navbar-toggle .icon-bar {
background-color: #333;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-custom">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link <span class="sr-only">(current)</span></a>
</li>
<li><a href="#">Link</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a>
</li>
<li><a href="#">Another action</a>
</li>
<li><a href="#">Something else here</a>
</li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a>
</li>
<li role="separator" class="divider"></li>
<li><a href="#">One more separated link</a>
</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a>
</li>
<li><a href="#">Another action</a>
</li>
<li><a href="#">Something else here</a>
</li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a>
</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>

关于html - ASP.Net MVC 控制标签栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41399650/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com