Search code examples
csstext-styling

How to disable text decoration with CSS?


So, I need to remove a visited link coloring from my navigation bar, as it will look ugly.

I have tried to use text-decoration: none; and color: white; but that does not seem to help it.

Still looks like this

CSS for navigation

Actual code

I removed the actual links from the code, in the real version there is link but for this question links are replaced with #


Solution

  • In addition to Bariock's answer, this will help reset your <a> links in all circumstances to your specified css.

    a:visited, a:hover, a:active, a:focus {
       color: yourColor !important;
       text-decoration: none !important;
       outline: none !important;
    }
    

    The !important signifies that it has a higher precedence than that of other rules declaring the same values for the same selectors. Note: you can still style them separately such like you would with :hover.