CSS Template: Rounded Button (border-radius + background)
📝 Use Case
This template is useful when you want to offer a clearly visible and stylish button for user actions. It’s simple enough for beginners to apply.
📘 Explanation
This CSS snippet uses border-radius to make the corners round and background-color to add color. You can use this for form submission buttons, links, and more.
🔹 Partial Code
<button class="rounded-button">Click Me</button>
<style>
.rounded-button {
background-color: #28a745;
color: white;
padding: 10px 20px;
border: none;
border-radius: 12px;
font-size: 1rem;
cursor: pointer;
}
</style>
🔸 Full HTML Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Rounded Button</title>
<link rel="stylesheet" href="/assets/css/template-common.css?v=1">
<style>
.rounded-button {
background-color: #28a745;
color: white;
padding: 10px 20px;
border: none;
border-radius: 12px;
font-size: 1rem;
cursor: pointer;
}
</style>
</head>
<body>
<button class="rounded-button">Click Me</button>
</body>
</html>
🎯 Advanced Design Techniques for Rounded Buttons
Rounded buttons are a fundamental element of modern UI design. This simple technique using border-radius greatly enhances the usability of user interfaces.
🌈 Customization Tips
Adjusting the value of border-radius can significantly change the impression of a button. Small values around 5px are suitable for business-like designs, while larger values like 25px give a friendlier feel. To create a fully circular button, specify 50%. Background colors can be changed according to the use case, such as #28a745 (green), #007bff (blue), or #dc3545 (red).
✨ Adding Interaction
Adding :hover and :active styles to basic buttons makes the UI more interactive. For example, .rounded-button:hover { background-color: #218838; transform: scale(1.05); } makes the button darker and slightly enlarged on hover. Adding the transition property smooths these changes.
📱 Tips for Responsive Design
On mobile devices, increasing the button’s padding (e.g., 15px 30px) makes it easier to tap. Using media queries like @media (max-width: 768px) { .rounded-button { padding: 15px 30px; } } is recommended for adjustments. Font sizes can also be adjusted according to screen width.
Rounded buttons are simple yet effective UI elements, but overusing them on a single page can reduce their visibility. It’s best to limit their use to key action buttons or truly important elements.