Outline (Ghost) Button Template
This template offers a modern, transparent button with a colored border, perfect for secondary actions.
Often called a "ghost button", its subtle design is ideal for choices like "Learn More" or "View Details" that should not distract from the page's main call-to-action.

About the Outline (Ghost) Button
An outline button provides a clean, minimalist aesthetic. By removing the background fill, it maintains a lower visual priority on the page, gracefully guiding users to less critical actions. The design relies on a clear border and text to define its shape and purpose. When the user interacts with it, the button fills with color, confirming its interactivity.
Features
- Minimalist Design: A transparent background and single-color border provide a clean look that works well on photographic or colorful backgrounds.
- Hover Effect: The button animates from outlined to solid on hover, creating a pleasing and intuitive user interaction.
- Accessible by Design: A clear
:focus-visible
style ensures keyboard users can easily identify the active element. - CSS-Only: The entire look and feel is achieved with HTML and CSS, making it lightweight and easy to implement.
Code Breakdown
The core styling for this button in its default state uses background-color: transparent
and a colored border
. A transition
is applied to multiple properties, including background-color
and color
. On hover, these properties are flipped: the background fills with color, and the text color changes to ensure it remains readable. Padding is calculated using the calc()
function to subtract the border width, ensuring consistent inner dimensions.
Code
Here is the complete code for the outline button template.