你好,我是新來的HTML和CSS,我使用bootstrap來創建一個網站。我正在尋找更改右側導航欄上的活動按鈕的顏色。也想改變文字顏色時,我已經看到了一些例子,但我無法將其應用於此示例。提前致謝。引導改變導航欄上的活動按鈕,CSS,HTML
HTML:
<div class="Menu">
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data- toggle="collapse" data-target="#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-left" href="http://www.website.com"> <img src="Logo.png" alt="LOGO">
</a>
</div>
<div id="navbar3" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container-fluid -->
</nav>
</div>
CSS:
navbar-right{
padding-top: 35px;
}
img {
padding-top: 17px;
padding-left: 17px;
}
.jumbotron {
padding-top: 10px;
padding-bottom: 48px;
border: 2px solid black;
}
.navbar-inverse .navbar-nav > li > a {
color: green;
}
.navbar3 > .navbar-nav .navbar-right>.active {
color:red;
background-color:yellow;
}
.navbar3 > .navbar-nav .navbar-right>.active > a,
.navbar3 > .navbar-nav .navbar-right>.active > a:hover,
.navbar3 > .navbar-nav .navbar-right>.active > a:focus{
color:red;
background:blue;
}
你會大概找到你在這裏尋找什麼:http://stackoverflow.com/questions/28712267/how-to-change-the-button-color-when-it-is-active-using-bootstrap – Majd
總是使用代碼片段或JSfiddle顯示你的工作代碼。 –
將在未來這樣做謝謝 – txm101