Mar*_*eau 0 html css hyperlink twitter-bootstrap
我希望所有链接在访问时都会改变颜色.我正在使用Bootstrap,这是我到目前为止所尝试的(这不能正常工作):
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="unicode">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" type="text/css" rel="stylesheet">
<style type="text/css">
a{
color:#d99a30 !important;
&:hover{ color:#37404e !important;}
&:visited{ color:#37404e !important;}
}
</style>
</head>
<body>
<div class="container">
<div class="col-md-8 col-md-offset-2">
<div class="row">
<div class="col-sm-12">
<h3><a href="some_link.html">Link</a></h3>
</div>
</div>
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助
您正在使用LESS/SASS的语法而不是纯CSS.以下是使用CSS的代码示例.
a { color:#d99a30 !important; }
a:hover { color:#37404e !important; }
a:visited { color:#37404e !important; }
Run Code Online (Sandbox Code Playgroud)
如果您想要:hover和:visited相同,您也可以简化该规则:
a { color:#d99a30 !important; }
a:hover, a:visited { color:#37404e !important; }
Run Code Online (Sandbox Code Playgroud)