HTML buttons automatically get a border, background-color, and a few other styles. These are default styles made by web browsers.
To remove the button border you have to specify
border: none in your CSS.
In the same vein, if you want to remove other default styles, you have to write additional CSS.
Button default style
Just by adding a button tag in your HTML, it will receive some styles from the web browsers. I added a button on my HTML document and tested it in 3 different web browsers. See the default styles in the screenshot below.
If you take a closer look at the above screenshot, you’ll see that Chrome & Firefox have nearly identical styles for the button. Such as
background-color. These two browsers also have the same hover effect.
On the other hand, Microsoft Edge has no
border-radius for the button and has a different hover effect.
This default style will/may vary from browser to browser. But you can always overwrite those default styles by writing CSS.
Overwriting button default styles
In the CSS below, I wrote a few lines of CSS that will change default styles. The properties are self-explanatory.
transition: background-color 0.5s ease-in-out;
You can add more styles to the button such as padding, margin, gradient color, etc. If you need inspiration, please see these button styles.
If you want to add fancy borders to the button, see this post. Live Preview →
For different rounded buttons, see this post. Live Preview →
A different way to remove the button border
At the beginning of this post, I mentioned that you can remove it by specifying none to the
Here I will show you a different approach/technic to remove the border.
You can remove or hide the border by specifying the same background & border color. See the following example CSS:
border: 2px solid #5ca731;
It’s actually not removing the border. Using the same color as the background & border, the border is unspecifiable in human eyes.
How to remove the outline border from the button?
The outline border is not always visible. If you click the button, you may notice a gray border. If you want to remove this outline border, write the following CSS:
/* OR */
Please note that an outline border is a good thing and beneficial for user experience. Screen readers use this mostly. If you keep pressing the tab key on your keyboard, the outline border will walk you through all the clickable elements. So don’t delete the outline border until you’re sure what you’re doing.
Learn more about buttons
- What is the difference between a link & button?
- How to create an HTML button that works like a link?
- How to style buttons with CSS
- How to center a button in CSS?
- How to create an image button?
- Button border examples
- Rounded buttons
- How to create a close button?
- How to remove the button border?
In this post, I explained two ways to remove button borders. I also explained how you can overwrite other default styles.
Additionally, you have links to other posts & demos that are related to buttons. Therefore if you still have any questions, please let me know.