Pill-Shaped Button Template

Add a touch of modern, friendly style to your interface with this soft, pill-shaped button.

This button's fully rounded corners create a capsule-like shape that is contemporary and approachable, ideal for actions in user-centric applications.

Screenshot of a pill-shaped button with fully rounded corners.

Get Source Code Preview

About the Pill-Shaped Button

The pill-shaped button is a simple but effective variation of the standard button. Its defining characteristic is a large border-radius that creates fully rounded ends, regardless of the button's width. This design is often perceived as more modern and less formal than buttons with sharp corners, contributing to a softer overall aesthetic for a web page or application.

Features

Code Breakdown

The key to this button's shape is the CSS rule border-radius: 999px;. Using a very large, fixed pixel value (larger than half the button's height will ever be) is a robust way to ensure the ends are always perfectly semicircular. The rest of the styling is straightforward, providing a solid background color, text color, and smooth transitions for the hover and focus states.

Code

Here is the complete code for the pill-shaped button.

View Output