How to get the blue color of links using CSS?

Posted on

Question :

My teacher asked me to recreate the pages of G1, Globo Esporte and Walmart. It wants the links “dead, so I use <a href="#"> . The problem is that there the content of a turns blue, and the pages have links in several different colors.

What I want to do is take that Blue from links , and leave the word that will turn link with the color it already is.

I have already used the text-decoration: none in CSS, but it did not work. Is there any other way to resolve this?


Answer :

In principle just inherit the color:

a { color: inherit; } 

This will make the element the color of your parent (which is what I think you’re looking for).

But if not, then just assign colors:

/* link que ainda não foi visitado */
a:link {
   color: red;

/* link que foi visitado */
a:visited {
    color: green;

/* mouse over */
a:hover {
    color: #000000;

/* link selecionado */
a:active {
    color: blue;

From what I’ve noticed, you have different colors for different links, so just assign the correct class a.<NOME DA CLASSE> :

/* link que ainda não foi visitado */
a.botao-vermelho:link {
   color: red;



Leave a Reply

Your email address will not be published. Required fields are marked *