suchen

Heim  >  Fragen und Antworten  >  Hauptteil

Wie entferne ich die Standard-Linkfarbe des HTML-Hyperlink-Tags „a“?

<p>Die Standard-Linkfarbe ist Blau. Wie entferne ich die Standard-Linkfarbe des HTML-Hyperlink-Tags <code><a></a></code><a>? </a></p>
P粉432906880P粉432906880463 Tage vor930

Antworte allen(2)Ich werde antworten

  • P粉884548619

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

    尝试这样的事情:

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

    如果text-decoration不起作用,请将其更改为:

    text-decoration: none !important;

    !important 规则会覆盖 text-decoration 属性的所有其他样式。您可以在此处阅读更多相关信息。

    Antwort
    0
  • P粉403804844

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

    继承值

    a { color: inherit; }

    ...将导致元素呈现其父级的颜色(我认为这就是您正在寻找的)。

    现场演示如下:

    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>

    Antwort
    0
  • StornierenAntwort