HTML Anchor, Disable Style

后端 未结 3 410
悲&欢浪女
悲&欢浪女 2021-02-06 21:48

I have some html anchor link code, and unlike the rest of document I want it to look like it is not a link.

Is there a simple way to disable the style change caused by w

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-06 22:33

    Setting color to black and text-decoration to explicitly none is a little more aggressive than worked for me.

    I was looking for the CSS of the anchors to be "benign" and just blend into the existing CSS. Here's what I went with:

    a.nostyle:link {
        text-decoration: inherit;
        color: inherit;
        cursor: auto;
    }
    
    a.nostyle:visited {
        text-decoration: inherit;
        color: inherit;
        cursor: auto;
    }
    

    Then I just added the CSS nostyle class to the anchors that I wanted to be unformatted.

提交回复
热议问题