gpt4 book ai didi

css - Bootstrap Nav pills a :visited not working

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

enter image description here
我是 Bootstrap 的新手。我正在使用 bootstrap Nav pills。我想更改标签颜色未访问的标签 - 黄色;已经访问过 tab- 红色;当前选项卡- 绿色。

访问过的链接没有变成红色。有人请帮帮我

<!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>

有人请帮我修复代码中的错误

最佳答案

.nav-pills>li.active>a:not(:visited), .nav-pills>li.active>a:focus:not(:visited) { background-color: green;

像这样尝试添加 :not(:visited)

关于css - Bootstrap Nav pills a :visited not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52234312/

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