gpt4 book ai didi

css - 更改不透明度 Bootstrap 导航栏

转载 作者:行者123 更新时间:2023-11-28 08:20:54 26 4
gpt4 key购买 nike

我试图在这段代码上让我的导航栏半透明,但我做不到:

 <nav class="navbar navbar-default navbar-fixed-top transparent" >
<div class="container">
<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">
<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="/">Home <span class="sr-only">(current)</span></a></li>
<li><a href="/searches">Searches</a></li>
<li><a href="/contact">Contact</a></li>

</ul>
<form class="navbar-form navbar-left" role="search">
<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 class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Legal <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="/terms">Terms</a></li>
<li><a href="/dmca">DMCA</a></li>
<li><a href="/rta">RTA</a></li>
<li class="divider"></li>
<li><a href="/contact">Contact</a></li>

最佳答案

在你的代码中试试这个,它对我有用 -

给导航一个id

像这样-

<nav class="navbar navbar-default navbar-fixed-top transparent" id="nav1">

然后在你的 css 中应用它-

#nav1
{
background-color:#F00; /*whichever you want*/
opacity: 0.5;
filter:(opacity=50);
}

关于css - 更改不透明度 Bootstrap 导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28769990/

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