如何使用 CSS 为按钮添加圆角?

cssweb developmentfront end technology更新于 2025/6/26 18:20:17

要为按钮添加圆角,请使用 border-radius 属性。

示例

您可以尝试运行以下代码来添加圆角 −

<!DOCTYPE html>
<html>
   <head>
      <style>
         .button {
            background-color: yellow;
            color: black;
            text-align: center;
            font-size: 15px;
            padding: 20px;
            border-radius: 15px;
         }
      </style>
   </head>
   <body>
      <h2>Result</h2>
      <p>Click below for result:</p>
      <button class = "button">Result</button>
   </body>
</html>

相关文章


有用资源