We can remove the default behavior of hyperlinks which is to show a dotted outline around themselves when active or focused by declaring CSS outline property on active/focused links to be none.
Solution
a, a:active, a:focus { outline: none; }
Example
Let’s see how to remove dotted line around active links with an example −
<!DOCTYPE html> <html> <head> <title>Remove dotted line around links using css</title> </head> <style> div { color: #000; padding:20px; background-image: linear-gradient(135deg, #dc3545 0%, #9599E2 100%); text-align: center; } a, a:active, a:focus { outline: none; } </style> <body> <div> <h1>HTML Links Demo</h1> <a href="https://google.com" target="_blank">Go To Google</a> </div> </body> </html>
Output
Following is the output for the above code −
Before applying the solution
After applying the solution