我试图忽略引导程序的默认<a></a>
标记(深色天空颜色),使我的文本看起来正常。
我的文字由<a>
代码和<span>
代码包装,因此<a>
代码的默认样式默认应用。
<a href="#">
<span class="text-bg"><strong>0</strong></span><br>
<span class="text-xs">NEW(999)</span>
</a>
<!-- 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>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="#">
<span class="text-bg"><strong>0</strong></span><br>
<span class="text-xs">NEW(999)</span>
</a>
我知道设置手动设置样式会很好,但是,传递<a>
标记样式并获得正常的文本颜色(灰色)会不那么痛苦。
有什么办法可以实现吗?感谢。
答案 0 :(得分:0)
您可以一次严格覆盖用户代理样式表。 这可能是解决方案。参见示例:
<!DOCTYPE html>
<html lang="en">
<head>
<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.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
a:-webkit-any-link {
color: -webkit-link !important;
cursor: auto !important;
text-decoration: underline !important;
}
a{
color: -webkit-link !important;
cursor: auto !important;
text-decoration: underline !important;
}
</style>
</head>
<body>
<a href="#">
<span class="text-bg"><strong>0</strong></span><br>
<span class="text-xs">NEW(999)</span>
</a>
</body>
</html>