How to style outline buttons using CSS ?
Last Updated :
28 Apr, 2025
This article will explore how to style outline buttons using CSS. The Outline buttons give a clean visual appearance. The clear and visible border ensures the clear separation from the background and other elements and enhances readability. We can achieve the outline buttons effect in two different ways including CSS Outline Property and CSS Border Property.
Outline CSS Property
The CSS 'outline' property is used to create a visible border around an element, providing a visual emphasis without affecting the layout. It's often used for highlighting interactive elements like buttons.
Approach
- Make the basic structure of the web page using elements <h1>, <h3>, and <button>. Link the external style sheet to the HTML file for giving styles to the elements.
- Set the property to the first button element having a class named "mybutton1" outline to solid 10px, then set the property for the second button having a class named "mybutton2" 10px inset, and for the third button set property 10px groove.
- Give different styles to the buttons like hover effect, transform, background color, etc for making buttons to enhance the overall user experience.
Example: The example shows how to style outline buttons using the outline CSS property.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>
Style outline buttons
using CSS
</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<h1>GeeksforGeeks</h1>
<h3>
Style outline buttons
using outline CSS property
</h3>
<button class="mybutton mybutton1">
Button
</button>
<button class="mybutton mybutton2">
Button
</button>
<button class="mybutton mybutton3">
Button
</button>
</body>
</html>
CSS
.mybutton {
width: 100px;
height: 100px;
font-size: 20px;
border: none;
margin-right: 20px;
transition: .2s linear;
}
h1 {
color: green;
}
.mybutton:hover {
transform: translateY(10px);
}
.mybutton1 {
outline: 10px solid rgba(202, 45, 131, 0.6);
border-radius: 10px;
}
.mybutton2 {
outline: 10px inset rgba(163, 26, 26, 0.6);
border-radius: 10px;
}
.mybutton1:hover {
background-color: rgba(242, 184, 216, 0.6);
}
.mybutton2:hover {
background-color: rgba(235, 152, 153, 0.6);
}
.mybutton3 {
outline: 10px groove rgba(47, 106, 22, 0.6);
border-radius: 10px;
}
.mybutton3:hover {
background-color: rgba(178, 244, 194, 0.6);
}
Output

CSS Border Property
The CSS 'border' property is used to define the border around an element, allowing control over its style, width, and color. It's widely used for shaping and emphasizing elements in web design.
Approach
- Make the basic structure of the web page using elements <h1>, <h3>, and <button>. Link the external style sheet to the HTML file for giving styles to the elements.
- Set the property to the first button element having a class named "mybutton1" border to 10px double and set the property for the second button having a class named "mybutton2" 5px dotted.
- Give different styles to the buttons like hover effect, transform, background color, etc for making buttons to enhance the overall user experience.
Example: The example shows how to style outline buttons using the border CSS property.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>
Style border buttons
using CSS
</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>GeeksforGeeks</h1>
<h3>
Style outline buttons
using border CSS property
</h3>
<button class="mybutton mybutton1">
Button
</button>
<button class="mybutton mybutton2">
Button
</button>
</body>
</html>
CSS
.mybutton {
width: 100px;
height: 100px;
font-size: 20px;
margin: 20px;
transition: .2s linear;
}
h1 {
color: green;
}
.mybutton:hover {
transform: translateY(10px);
}
.mybutton1 {
border: 10px double rgba(53, 22, 192, 0.6);
border-radius: 10px;
}
.mybutton2 {
border: 5px dotted rgba(163, 26, 26, 0.6);
border-radius: 10px;
}
.mybutton1:hover {
background-color: rgba(118, 152, 221, 0.6);
}
.mybutton2:hover {
background-color: rgba(235, 152, 153, 0.6);
}
Output
Similar Reads
How to Style Round Buttons using CSS? Round buttons are circular buttons used on websites. They usually have icons or text for actions. To style round buttons using CSS, set their width and height equal, use border-radius: 50% for a circular shape, and add colors and hover effects.Add Style To Round Buttons Using CSSMake a basic structu
2 min read
How to Style Text Buttons using CSS? Text buttons are buttons that consist only of text without any additional background or border styling. They are commonly used for simple actions or navigation elements in a website or web application. Table of Content Basic StylingHover EffectsBasic StylingIn basic CSS we can style text buttons usi
2 min read
How to create Text Buttons using CSS ? In this article, we are going to see how to create text buttons using CSS. The text button is a button that appears to be text but acts as a button if we press it. Text buttons are different from anchor tags even if they might look similar. To create text buttons first, we create simple buttons in H
2 min read
How to style block buttons (full-width) using CSS ? In this article, we will explore how to style block buttons with full width using CSS. Making buttons stand out on a website is crucial. Such types of buttons provide responsiveness to the web page that works well on various devices. Styling buttons with clear words, appealing colors, and effects, c
3 min read
How to Add Text Outline with CSS? Since CSS does not provide a direct text-outline property, the CSS text-shadow property is used to create an outline effect around text by adding multiple shadows with offsets.1. Using text-shadow PropertyThe text-shadow property is commonly used to add shadows to text, by applying multiple shadows
1 min read