Remove the complete styling of an HTML button/submit
Let's deploy the CSS power to strip all the default styles from HTML button using appearance: none;
and setting border
, background
, padding
, margin
, and outline
to 0:
And voila! We have a blank canvas - a barebones button.
Special instructions for Internet Explorer (IE)
News Flash: IE has oddball ways of messing with styled buttons. Let's tackle them one-by-one:
Stopping the button content shifting on click
IE applies an annoying mousedown
effect by default. Let's turn that off:
Eliminating odd button saddening
Waving goodbye to hover and focus defaults
This code keeps the visual identity consistent across browsers.
How to handle sprites
Sprites can move your button around in IE. Fix this by keeping the button's size stable:
Reset with Bootstrap 4
If you're leveraging the power of Bootstrap 4, apply these classes:
Retain focus
Note: Check the compatibility of every style you used on caniuse.com.
Perfect, now it's just buttons
Know how to reset a button to bare bones? Now, let's proceed on making it catch eyes!
Precious resets
When resetting, remember don't use all: unset;
, it’s a Pandora's Box and isn't supported in IE.
Stay usable
Accessibility is not optional. Make sure your button remains usable after revolutionizing its looks.
Make it adaptable
Finally, ensure your styling responds and adapts to various devices and screens. Consistency delivers professional experience across platforms.
Was this article helpful?