提问者:小点点

有没有办法根据按钮形状来“塑造”CSS按钮轮廓?


有没有可能对单击CSS按钮时出现的轮廓进行整形?当点击一个圆角按钮时,轮廓看起来有点偏离。

null

<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
  <meta charset="utf-8">
  <title></title>
  <style media="screen">
    .button {
      border-radius: 80%;
      padding: 16px 32px;
    }
  </style>
</head>

<body>
  <button class="button">BUTTON</button>
</body>

</html>

null


共3个答案

匿名用户

你可以改变现有边框的宽度,当按钮进入焦点(或活动)-你也可以选择改变它的颜色或样式(脊等),如你所愿。

null

.button:focus, .button:active {
    outline-style:none;
    border-width: 5px;
    border-color: black;
    border-style: solid;
} 
        .button {
          border-radius: 80%;
          padding: 16px 32px;
        }
      <button class="button">BUTTON</button>

匿名用户

重写按钮焦点上的大纲行为。

null

<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
  <meta charset="utf-8">
  <title></title>
  <style media="screen">
    .button {
      border-radius: 80%;
      padding: 16px 32px;
    }
    .button:focus {
      outline: none;
      box-shadow: 0px 4px 7px 0px #888888;
    }
  </style>
</head>

<body>
  <button class="button">BUTTON</button>
</body>

</html>

匿名用户

我不知道如何“整形”,但我确信您可以使用outline:none;来改变轮廓。您可以在active,focus和hover上使用此属性来查看是否有效。