使用 CSS 更改按钮的内边距

cssweb developmentfront end technology更新于 2024/7/28 7:08:17

要更改按钮的内边距,请使用 padding 属性。

您可以尝试运行以下代码来更改按钮的内边距

示例

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

相关文章


有用资源