gpt4 book ai didi

css - 如何更改 Bootstrap 导航栏中选定下拉菜单的颜色?

转载 作者:太空宇宙 更新时间:2023-11-03 22:16:02 24 4
gpt4 key购买 nike

只要单击下拉项,其颜色就会变为白色,从而使白色文本变得不可读。

我已经试过了 this但解决方案对我不起作用。 Here是我的片段

        <div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">Demo</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">

<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Applications<span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-left">
<li><a href="#">Communications</a></li>
<li><a href="#">Environmental</a></li>
<li><a href="#">General</a></li>
<li><a href="#">Programmable</a></li>
</ul>
</li>
<li><a href="#">Product Selector</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" style="background-color:#000;margin-top:15px; border-radius: 0">
<div class="input-group-btn">
<button class="btn btn-default" type="submit" style="background-color:#000;margin-top:15px;border-radius: 0"><i class="glyphicon glyphicon-search" style="color:#fff;"></i></button>
</div>
</div>
</form>
</li>
<li><a href="#"><i class="glyphicon glyphicon-shopping-cart logo-small"></i></a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="glyphicon glyphicon-user logo-small"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a asp-area="Identity" asp-page="/Account/Login">Login</a></li>
<li><a asp-area="Identity" asp-page="/Account/Register">Register</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>

我希望事件选择的背景与下拉项背景的颜色相同。提前致谢!

最佳答案

这是相关的选择器。将其更改为您需要的任何颜色。 Updated example

.dropdown-menu > li > a:focus {
background-color: initial; /* Equivalent to background-color: transparent */
}

关于css - 如何更改 Bootstrap 导航栏中选定下拉菜单的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56741299/

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