gpt4 book ai didi

css - BootStrap的默认 anchor 标签样式如何传递

转载 作者:行者123 更新时间:2023-11-28 02:48:20 25 4
gpt4 key购买 nike

我试图忽略默认 <a></a> bootstrap 的标签(暗天空颜色)使我的文本显示正常。

我的文字由 <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> 会不那么痛苦标记样式并获取正常的文本颜色(灰色)。

有什么办法可以实现吗?谢谢。

最佳答案

您可以一次严格覆盖用户代理样式表。这可能是解决方案。看例子:

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

关于css - BootStrap的默认 anchor 标签样式如何传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46802796/

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