如何使用 CSS 为按钮添加彩色边框?

cssweb developmentfront end technology更新于 2025/6/28 13:00:17

要添加彩色边框,请使用 CSS border 属性。

示例

您可以尝试运行以下代码来添加彩色边框。

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

相关文章


有用资源