gpt4 book ai didi

css - Bootstrap 导航栏背景颜色规则不起作用

转载 作者:行者123 更新时间:2023-11-28 05:01:27 25 4
gpt4 key购买 nike

当我尝试更改我的导航栏背景颜色时,它在 Google Chrome 检查器中变成灰色。在谷歌上找不到有效的解决方案。

当我删除 navbar-default 时它确实发生了变化,但是我在较小的屏幕上看不到切换图标。

我也尝试将规则应用于 navbar-default 但结果相同。背景颜色不变。

body {
font-family: "Courier New" ;
}
.ttposter{
color:black;
height:400px;
width:250px;
}

.navbar-custom {
background-color:#e74c3c;
color:#ffffff;
border-radius:0;
margin-bottom: 0;
}

.navbar-custom .navbar-nav > li > a {
color:#fff;
}
.navbar-custom .navbar-nav > .active > a, .navbar-nav > .active > a:hover, .navbar-nav > .active > a:focus {
color: #ffffff;
background-color:transparent;
}

.navbar-custom .navbar-brand {
color:#eeeeee;
}
.headerImgText{
color:white;
margin: 10%;
}

body,html {
height: 100%;
}
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!--Custom css-->
<link rel="stylesheet" type="text/css" href="CSS/styles.css">
<!--Javascript-->
<script type="text/javascript" src="scripts/movies.js"></script>
<title>Homepage</title>
</head>
<body onload="loadFeaturedMovies()">
<header>
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
<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="collapsed" 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="#">Notflix</a>
</div>

<!-- LINKS -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="index.html">HOME</a></li>
<li><a href="movies.html">MOVIES</a></li>
<li><a href="users.html">USERS</a></li>
<li><a href="login.html">ACCOUNT</a></li>

</ul>
<!-- LOGIN -->
<form class="navbar-form navbar-right">
<div class="form-group">
<input type="text" id="loginUsername" class="form-control" placeholder="username">
<input type="password" id="loginPassword" class="form-control" placeholder="password">
</div>
<button type="submit" onclick="login()" class="btn btn-default">Login</button>
</form>
</div>
</div>
</nav>
</header>

最佳答案

检查您的 navbar-header 类。在它下面有一个带有 data-toggle="collapsed" 的按钮。将其更改为 data-toggle="collapse"

加上 Rahul 指示的应用 css:

.navbar-custom {
background-image: none;
}

参见 fiddle :https://jsfiddle.net/DTcHh/26317/

关于css - Bootstrap 导航栏背景颜色规则不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40086090/

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