gpt4 book ai didi

css - 将 navbar-brand 的颜色更改为两种颜色

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

我想更改 navbar-brand 以便这两个词是两种不同的颜色。我现在很难做到这一点,因为无论我使用什么 CSS,它似乎都不会改变颜色。我使用的填充确实生效,所以它是针对它的,只是没有改变颜色。谁能帮我做我需要做的事?

<nav class="navbar navbar-inverse navbar-fluid" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<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="#"><div class="translation">TRANSLATION</div><div class="commons">COMMONS</div></a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav nav pull-right">
<li>
<a href="#">Home</a>
</li>
<li>
<a href="#">Register</a>
</li>
<li>
<a href="#">Log In</a>
</li>
<li>
<a href="#">About</a>
</li>
<li>
<a href="#">Contact</a>
</li>
<li>
<a href="#">Donate</a>
</li>
</ul>
</div>
</div>

最佳答案

使用 SPAN 并指定颜色。

.red {
color: red;
}
.white {
color: white;
}
<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.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-inverse navbar-fluid" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <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="#"><span class="red">TRANSLATION</span> <span class="white">Commons</span></a>

</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav nav pull-right">
<li><a href="#">Home</a>

</li>
<li><a href="#">Register</a>

</li>
<li><a href="#">Log In</a>

</li>
<li><a href="#">About</a>

</li>
<li><a href="#">Contact</a>

</li>
<li><a href="#">Donate</a>

</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>

关于css - 将 navbar-brand 的颜色更改为两种颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31923223/

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