search

Home  >  Q&A  >  body text

How to remove the default link color of html hyperlink "a" tag?

<p>The default link color is blue. How to remove the default link color of html hyperlink tag <code><a></a></code><a>? </a></p>
P粉432906880P粉432906880460 days ago929

reply all(2)I'll reply

  • P粉884548619

    P粉8845486192023-08-24 13:50:34

    Try something like this:

    a {
        color: #0060B6;
        text-decoration: none;
    }
    
    a:hover {
        color:#00A0C6; 
        text-decoration:none; 
        cursor:pointer;  
    }

    If text-decoration doesn't work, change it to:

    text-decoration: none !important;
    The

    !important rule overrides all other styles with the text-decoration attribute. You can read more about it here.

    reply
    0
  • P粉403804844

    P粉4038048442023-08-24 00:19:50

    Inherited value:

    a { color: inherit; }

    ...will cause the element to take on the color of its parent (I think this is what you're looking for).

    The live demonstration is as follows:

    a {
      color: inherit;
    }
    <p>The default color of the html element is black. The default colour of the body and of a paragraph is inherited. This
      <a href="http://example.com">link</a> would normally take on the default link or visited color, but has been styled to inherit the color from the paragraph.</p>

    reply
    0
  • Cancelreply