我是Bootstrap的新手。我正在使用引导Nav药丸。我想更改未访问的标签颜色-黄色;已经访问过的表格-当前选项卡-绿色。
访问的链接未更改为红色。有人请帮助我
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.nav-pills>li>a {
background-color: yellow;
color: white;
border-radius: 0px;
}
.nav-pills>li>a:visited {
background-color: red;
}
.nav-pills>li.active>a,
.nav-pills>li.active>a:focus {
background-color: green;
}
</style>
</head>
<body>
<div class="container">
<ul class="nav nav-pills">
<li class="active">
<a data-toggle="pill" href="#home">Home</a>
</li>
<li>
<a data-toggle="pill" href="#menu1">Menu 1</a>
</li>
<li>
<a data-toggle="pill" href="#menu2">Menu 2</a>
</li>
<li>
<a data-toggle="pill" href="#menu3">Menu 3</a>
</li>
</ul>
<div class="tab-content">
<div id="home" class="tab-pane fade in active">
home
</div>
<div id="menu1" class="tab-pane fade">
menu 1
</div>
<div id="menu2" class="tab-pane fade">
menu 2
</div>
<div id="menu3" class="tab-pane fade">
menu 3
</div>
</div>
</div>
</body>
</html>
请有人帮我修复代码中的错误
答案 0 :(得分:0)
.nav-pills> li.active> a:not(:visited),.nav-pills> li.active> a:focus:not(:visited){background-color:green; }
尝试在添加:not(:visited)的情况下进行尝试