Marvin Lerousseau Marvin Lerousseau - 4 months ago 63
CSS Question

Bootstrap - Change the color of visited links

I would like that all the links change their color when they are visited. I am working with Bootstrap and this is what I have tried so far (that doesn't work properly) :

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


Thanks for your help

Answer

You are using the syntax for LESS/SASS instead of plain CSS. Here is an example of your code using CSS.

a { color:#d99a30 !important; }
a:hover { color:#37404e !important; }
a:visited { color:#37404e !important; }

If you want :hover and :visited to be the same, you can also simplify that rule too:

a { color:#d99a30 !important; }
a:hover, a:visited { color:#37404e !important; }
Comments