Why is link underline appearing after clicking the link?

后端 未结 4 1137
执念已碎
执念已碎 2020-12-28 14:01

I have an anchor tag styled with text-decoration: none.

This has removed the underline from my links, which is what I want.

However after the l

4条回答
  •  再見小時候
    2020-12-28 15:03

    The right way and you should cover this by adding the following css in your style sheet definition:

    **Longer CSS Styling definition:** 
    
    a:link {
        text-decoration: none;
    }
    
    a:visited {
        text-decoration: none;
    }
    
    a:hover {
        text-decoration: none;
    }
    
    a:active {
        text-decoration: none;
    }
    
    **Shorter CSS definition:**
    
    a, a:visited, a:hover, a:active {
        text-decoration:none;
    }
    

    this will ensure no underlining in all state of links to be absolutely sure that there will not be underlining in any of the links on the page. You can also condense the styling definition in your css so the code isn't long and it's more efficient to control style for all link behaviours because it applies to all of the links on the page when you're defining a

    if you want to style it for specific links you'd do the following:

    a.nav:link    {text-decoration: none; }
    a.nav:visited {text-decoration: none; }
    a.nav:hover   {text-decoration: none; }
    a.nav:active  {text-decoration: none; }
    
    styled links.
    

    or something completely different adding in colours, overline, font weight, size which are going to be different in each link state for that specific class.

    a.external:link    {color: #0000ff; font-size: 18pt; font-weight: bold; }
    a.external:visited {color: #894f7b; font-weight: bold; }
    a.external:hover   {text-decoration: overline; background-color: #003399; }
    a.external:active  {color: red; }
    

提交回复
热议问题