去除按钮的阴影

Removing the shadow from a button

我要的按钮是最下面的那个,我有的是最上面的那个。

问题出在 HTML:

中的顶部按钮
<form class="button_to" method="get" action="/"><input type="submit" value="Ok" /></form>

和 HTML 中的底部按钮:

<button type="button">Ok</button>

顶部按钮的 CSS 是:

.signup-success input[type="submit"],
.signup-success input[type="submit"]:active,
.signup-success input[type="submit"]:focus {
  width: 80%;
  background: transparent;
  color: #00AA66;
  border-color: #00AA66;
}

底部按钮的 CSS 是:

.signup-success button,
.signup-success button:active,
.signup-success button:focus {
  margin-top: 15px;
  width: 80%;
  background: transparent;
  color: #00AA66;
  border-color: #00AA66;
}

如果有帮助,顶部按钮是从 rails .erb 扩展名

生成的
<%= button_to "Ok", root_path, :method => :get %>

帮助我让我的顶部按钮看起来像底部按钮。我试图在 CSS 中添加禁用阴影的代码,但没有成功:(

使用边框样式:

.signup-success input[type="submit"],
.signup-success input[type="submit"]:active,
.signup-success input[type="submit"]:focus {
  width: 80%;
  background: transparent;
  color: #00AA66;
  border-color: #00AA66;
  border-style: solid;
}

或组合版本(border-style, border-width and border-color in one):

border: 2px solid #00AA66;

或者你可以简单地给你的按钮 border: none

有趣的是,为按钮添加边框修复了 safari 的奇怪投影。

border: 1px solid #34c1e5;

只需添加您自己的边框即可。

border: 1px solid black;

或者去掉边框。

border: none;