Skip to content

Instantly share code, notes, and snippets.

@topherPedersen
Last active November 30, 2023 11:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save topherPedersen/f0f9b9fd91a375506860f4505a739fa7 to your computer and use it in GitHub Desktop.
Save topherPedersen/f0f9b9fd91a375506860f4505a739fa7 to your computer and use it in GitHub Desktop.
How to Prevent a Button from Changing its Border and Background Color in CSS When Clicked
<!DOCTYPE html>
<html>
<head>
<style>
.noFlash {
/* Remove onclick Background Color Change */
/* REFERENCE: https://bit.ly/2Yc95wR */
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
.noFlash:focus {
/* Remove onclick Border Color Change */
/* REFERENCE: https://bit.ly/2KFgNG7 */
outline: none;
background-color: white!important;
}
</style>
</head>
<body>
<button class="noFlash">CLICK ME</button>
</body>
</html>
@PalomaCortez
Copy link

@suprasuper
Copy link

ty king

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment