Skip to content

Instantly share code, notes, and snippets.

@andreasvirkus
Created August 7, 2017 11:01
Show Gist options
  • Save andreasvirkus/0a648187f222075d6197df02e2be3f79 to your computer and use it in GitHub Desktop.
Save andreasvirkus/0a648187f222075d6197df02e2be3f79 to your computer and use it in GitHub Desktop.
The proper way to get rid of outline styles _aesthetically_, whilst keeping them for accessibility purposes!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<style id="_outline-styles">
/* Outline styles will be injected here */
</style>
</head>
<body onmousedown="document.getElementById('_outline-styles').innerHTML='a,a:active,a:focus{outline:none}';"
onkeydown="document.getElementById('_outline-styles').innerHTML='';">
<noscript>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment