[英]How to remove hover effect from Bootstrap button?
我有一個 Bootstrap 按鈕,在其中我覆蓋了樣式表中的樣式,因為我想讓按鈕變暗,現在按鈕上有 Bootstrap 的懸停效果,我該如何擺脫它? 有關結果,請參見下面的代碼段:
.btn-dark { min-width: 100px; background-color: black; color: white; border-radius: 1px; text-decoration: none; opacity:1.0; box-shadow:none; }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <a href="#" class="btn btn-dark space hvr-pulse tog1" data-toggle="modal" data-target="#exampleModalCenter"><i class="fab fa-telegram-plane"></i> SEND US A MESSAGE</a>
嘗試使用 :hover 選擇器並添加更多 CSS 來指定設計的確切過渡。
.btn-dark:hover {
color: white;
}
<!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">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.btn-dark{
min-width: 100px;
background-color: black;
color: white;
border-radius: 1px;
text-decoration: none;
}
.btn:hover {
color: #fff !important;
text-decoration: none;
}
</style>
</head>
<body>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<a href="#" class="btn btn-dark space hvr-pulse tog1" data-toggle="modal" data-target="#exampleModalCenter"><i class="fab fa-telegram-plane"></i> SEND US A MESSAGE</a>
</body>
</html>
小提琴: https ://jsfiddle.net/1qmjw47o/
您還需要在樣式中覆蓋懸停。
.btn-dark: hover {
//Your style
}
只需使用
.btn:hover {
}
並寫下必要的。
.btn-dark{ min-width: 100px; background-color: black; color: white; border-radius: 1px; text-decoration: none; opacity:1.0; box-shadow:none; } .btn-dark:hover { color: #fff !important; text-decoration: none; }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <a href="#" class="btn btn-dark space hvr-pulse tog1" data-toggle="modal" data-target="#exampleModalCenter"><i class="fab fa-telegram-plane"></i> SEND US A MESSAGE</a>
我這樣做的方法是禁用懸停找到您的按鈕,然后將懸停顏色與按鈕顏色相同..
.e-btn.e-flat, .e-css.e-btn.e-flat {
background-color: #EB780A;
border-color: #EB780A;
}
並禁用懸停顏色 - 在最后添加懸停。
.e-btn.e-flat:hover, .e-css.e-btn.e-flat:hover {
background-color: #EB780A;
border-color: #EB780A;
}
您可以將元素上的 css 設置為pointer-events:none
。 看這里。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.