【问题标题】:Removing the shadow from a button移除按钮的阴影
【发布时间】:2015-12-04 05:56:42
【问题描述】:

我想要的是底部的按钮,但我拥有的是顶部的按钮。

问题在于 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 中添加禁用阴影的代码,但没有成功:(

【问题讨论】:

  • 尝试设置边框:无;首先,然后在它之后设置边框。边框:无;边框:2px 实心#00aa66;
  • 尝试设置border-width属性....玩不同的值。

标签: html css ruby-on-rails shadow


【解决方案1】:

使用边框样式:

.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: 2px solid #00AA66;

【讨论】:

  • 稍微调整了边界半径和高度,我得到了我想要的确切形状。谢谢!和大声笑简单的解决方案,我猜我已经不耐烦了,因为我已经编码了很长时间。
  • 今天完全脑残了,感谢上帝这个简单的答案。
  • 非常感谢您的回答!这几天试图解决这个小问题。
  • 边框样式:实心;是为我做了什么
【解决方案2】:

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

【讨论】:

    【解决方案3】:

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

    border: 1px solid #34c1e5;

    【讨论】:

      【解决方案4】:

      只需添加您自己的边框。

      border: 1px solid black;
      

      或者去掉边框。

      border: none;
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-04-28
        • 2022-01-01
        • 2015-04-29
        • 2022-01-21
        • 1970-01-01
        • 1970-01-01
        • 2017-09-01
        • 2016-08-17
        相关资源
        最近更新 更多