圆角按钮是一种常见的用户界面元素,其特点是按钮的四个角是圆弧形的。这种设计不仅美观,还能减少用户的视觉冲击,提升用户体验。
以下是一个简单的CSS示例,展示如何创建一个圆角按钮:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>圆角按钮示例</title>
<style>
.rounded-button {
display: inline-block;
padding: 10px 20px;
font-size: 16px;
color: white;
background-color: #007bff;
border: none;
border-radius: 10px; /* 圆角半径 */
cursor: pointer;
text-align: center;
text-decoration: none;
transition: background-color 0.3s ease;
}
.rounded-button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<a href="#" class="rounded-button">点击我</a>
</body>
</html>
-webkit-
, -moz-
)来兼容不同浏览器。-webkit-
, -moz-
)来兼容不同浏览器。border-radius
的相对单位(如%
)或媒体查询来适应不同的设备。border-radius
的相对单位(如%
)或媒体查询来适应不同的设备。通过以上方法,可以有效地创建和优化圆角按钮,提升用户体验。
领取专属 10元无门槛券
手把手带您无忧上云