要素の状態がfocus
の場合にはわかりませんが、.nav-pills
(下の例を参照)のいずれかをクリックすると、マウスを動かしても.active
と表示されます私がページの他の場所をクリックするまで、それをオフにします。 Google ChromeのWebインスペクタでは、このことの証拠は表示されません。私は最初の錠剤を私のページの唯一の活性な丸薬にしたい。BS .nav-pills stay depressed
/* Primary Syle Sheet */
/* Basic Typography */
#topnav {
\t margin-bottom: 30px;
}
#topnav .nav-pills > li {
\t margin-left: 11px;
\t margin-right: 11px;
\t text-size: 100px;
}
#topnav>.nav-pills>li>a {
\t padding-top: 11px;
\t padding-bottom: 11px;
\t font-size: 24px;
\t color: #333;
}
#topnav>.nav-pills>li.active>a, #topnav>.nav-pills>li>a:hover {
\t background-color: #eee;
}
.nav-pills>li>a:hover {
\t opacity: 0.7;
}
#navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
line-height: 20px;
}
@media (min-width: 768px) {
\t #navbar-nav>li>a {
\t padding-top: 15px;
\t padding-bottom: 15px;
\t margin-top: 3px;
\t margin-bottom: 3px;
}
#navbar-nav {
\t width: 100%;
\t text-align: center !important;
\t }
\t #navbar-nav > li {
\t float: none;
\t display: inline-block;
}
}
.center-pills {
\t display: inline-block;
}
.h1 small.sbttl, .h2 small.sbttl, .h3 small.sbttl, .h4 small.sbttl, .h5 small.sbttl, .h6 small.sbttl, h1 small.sbttl, h2 small.sbttl, h3 small.sbttl, h4 small.sbttl, h5 small.sbttl, h6 small.sbttl {
\t display: block;
\t font-size: 33%;
\t color: inherit !important;
\t opacity: 0.75;
}
/* Targeted Stylings */
header {
background-color: yellow;
background-repeat: no-repeat;
background-attachment: scroll;
background-position: center center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
text-align: center;
color: #fff !important;
}
@media (min-width: 768px) {
\t header .brand-name {
\t padding-top: 200px !important;
\t padding-bottom: 200px !important;
\t }
}
header .brand-name {
padding-top: 100px;
padding-bottom: 100px;
}
header .brand-name h1 {
\t font-size: 75px;
\t font-style: italic;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Example</title>
<!-- Primary Stylesheets -->
<link href="css/styles_1.css" rel="stylesheet">
<!-- Bootstrap -->
<!-- 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">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body id="page-top" class="index">
\t <header>
\t \t <div class="container">
\t \t \t <div class="brand-name">
\t \t \t \t <h1>Title <small class="sbttl">Subtitle</small></h1>
\t \t \t </div>
\t \t
\t \t \t <!-- Initial -->
\t \t \t <div class="container text-center" id="topnav">
\t \t \t \t <ul class="nav nav-pills center-pills">
\t \t \t \t \t <li role="presentation" class="active"><a href="#">content</a></li>
\t \t \t \t \t <li role="presentation"><a href="#">content</a></li>
\t \t \t \t \t <li role="presentation"><a href="#">content</a></li>
\t \t \t \t \t <li role="presentation"><a href="#">content</a></li>
\t \t \t \t </ul>
\t \t \t </div>
\t \t </div>
\t </header>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
</body>
</html>
申し訳ありませんが、私は私のスニペットにはあまり含まれている場合は、私はスタックオーバーフロー新たなんです。
...私が必要とするページのどこかをクリックするまで、その状態に留まるのを止めるには? – jajaperson
あなたのCSSの 'li:hover'からすべてを削除したい、あるいは' li:hover {color:black; } 'またはあなたのデザインに最も適したもの。 – mark
しかし、マウスが実際にマウスの上に乗るときにホバー状態を見ることはできません。さらに、ピルの色が「:ホバー」のピルの色と一致しないので、この解決策が正しいかどうかわからない – jajaperson