Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML default link color

Tags:

html

css

I want to set color of some elements to default link color with CSS.

<a href="/">That color</a> is the same as <span style="color: link;">that</span>.

Any way to do that? This website don't change default browser's link color.

like image 518
Simon Perepelitsa Avatar asked Mar 09 '10 06:03

Simon Perepelitsa


People also ask

How do you color code a link in HTML?

Link color using Hex color codes To start with we'll use a Hex color code, probably the most common method of adding color to links. In your HTML anchor tag (<a>), after the href attribute, insert a style attribute with the color property set to your Hex color code (in our case #FF0000).


1 Answers

Even if you don't change the default color, it would still be a good idea to specify the color to ensure that it looks the same in all browsers. I'd put something like this in the stylesheet:

a, span.link {
  color: blue;
}

a:visited, span.visited {
   color: purple;
}

a:active, span.active {
   color: red;
}

Then you can style spans as links by <span class="link">Your fake link</span>

like image 167
PatrikAkerstrand Avatar answered Sep 17 '22 22:09

PatrikAkerstrand