【问题标题】:href not working with class, no java scripthref 不适用于类,没有 javascript
【发布时间】:2025-11-28 13:50:02
【问题描述】:

我遇到了一个不允许我点击按钮的未知问题。我有三个相同类的按钮button blue,没有id。前两个按钮不可点击,但最后一个效果很好。我被这个问题困住了。父代码中没有 z-index。

.button {
  text-decoration: none;
  text-align: center;
  color: white;
  padding: 10px 50px 10px 10px;
  display: inline-block;
  text-shadow: -2px 2px 0 rgba(0, 0, 0, 0.2);
  font-weight: bold;
  margin: 8px 10px 12px;
  transition: all 0.1s linear;
  -moz-transition: all 0.1s linear;
  -o-transition: all 0.1s linear;
  -webkit-transition: all 0.1s linear;
  transform: translateZ(0);
  -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  -webkit-transform: translateZ(0);
}
.button.blue {
  background: linear-gradient(to bottom, #0074FF, #0074FF);
  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0074FF), color-stop(100%, #0074FF));
  background: -moz-linear-gradient(top, #0074FF, #0074FF);
  background: -webkit-linear-gradient(top, #0074FF, #0074FF);
  box-shadow: -1px 0px 1px #6fadcb, 0px 1px 1px #54809d, -2px 1px 1px #6fadcb, -1px 2px 1px #54809d, -3px 2px 1px #6fadcb, -2px 3px 1px #54809d, -4px 3px 1px #6fadcb, -3px 4px 1px #54809d, -5px 4px 1px #6fadcb, -4px 5px 1px #54809d, -6px 5px 1px #6fadcb, -6px 7px 0 rgba(0, 0, 0, 0.05), -5px 8px 0 rgba(0, 0, 0, 0.05), -3px 9px 0 rgba(0, 0, 0, 0.04), -2px 10px 0 rgba(0, 0, 0, 0.04), -1px 11px 0 rgba(0, 0, 0, 0.03), 0px 12px 0 rgba(0, 0, 0, 0.03), 1px 13px 0 rgba(0, 0, 0, 0.02), 2px 14px 0 rgba(0, 0, 0, 0.02), 3px 15px 0 rgba(0, 0, 0, 0.01), 4px 16px 0 rgba(0, 0, 0, 0.01), 5px 17px 0 rgba(0, 0, 0, 0.01), 6px 18px 0 rgba(0, 0, 0, 0.01), inset 0 4px 5px -2px rgba(255, 255, 255, 0.5), inset 0 1px 0 0 rgba(0, 0, 0, 0.3);
}
.button:active {
  box-shadow: none;
  transform: translate3d(-6px, 6px, 0);
  -moz-transform: translate3d(-6px, 6px, 0);
  -ms-transform: translate3d(-6px, 6px, 0);
  -webkit-transform: translate3d(-6px, 6px, 0);
}
 <a href="https://www.flippaisa.com" class="button blue">1 Go to FP</a>
 <a href="https://www.flippaisa.com" class="button blue">2 Go to FP</a>
 <a href="https://www.flippaisa.com" class="button blue">3 Go to FP</a>

【问题讨论】:

标签: html css href


【解决方案1】:

我刚刚在 JSfiddle https://jsfiddle.net/RamiSarieddine/syg2b1ws/ 上尝试过,效果很好。你可以点击按钮。

<a href="https://www.flippaisa.com" class="button blue" >Go to FP</a>

.button {
text-decoration: none;
text-align:center;
color: white;
padding: 10px;
display: inline-block;
text-shadow: -2px 2px 0 rgba(0, 0, 0, 0.2);
font-weight: bold;
padding-right: 50px;
margin-bottom:12px;
margin-left:10px;
margin-top:8px;
margin-right:10px;
-moz-transition: all 0.1s linear;
-o-transition: all 0.1s linear;
-webkit-transition: all 0.1s linear;
transition: all 0.1s linear;
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
-webkit-transform: translateZ(0);
transform: translateZ(0);
}

.button.blue {
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0074FF), color-stop(100%, #0074FF));
background: -moz-linear-gradient(top, #0074FF, #0074FF);
background: -webkit-linear-gradient(top, #0074FF, #0074FF);
background: linear-gradient(to bottom, #0074FF, #0074FF);
box-shadow: -1px 0px 1px #6fadcb, 0px 1px 1px #54809d, -2px 1px 1px #6fadcb, -1px 2px 1px #54809d, -3px 2px 1px #6fadcb, -2px 3px 1px #54809d, -4px 3px 1px #6fadcb, -3px 4px 1px #54809d, -5px 4px 1px #6fadcb, -4px 5px 1px #54809d, -6px 5px 1px #6fadcb, -6px 7px 0 rgba(0, 0, 0, 0.05), -5px 8px 0 rgba(0, 0, 0, 0.05), -3px 9px 0 rgba(0, 0, 0, 0.04), -2px 10px 0 rgba(0, 0, 0, 0.04), -1px 11px 0 rgba(0, 0, 0, 0.03), 0px 12px 0 rgba(0, 0, 0, 0.03), 1px 13px 0 rgba(0, 0, 0, 0.02), 2px 14px 0 rgba(0, 0, 0, 0.02), 3px 15px 0 rgba(0, 0, 0, 0.01), 4px 16px 0 rgba(0, 0, 0, 0.01), 5px 17px 0 rgba(0, 0, 0, 0.01), 6px 18px 0 rgba(0, 0, 0, 0.01), inset 0 4px 5px -2px rgba(255, 255, 255, 0.5), inset 0 1px 0 0 rgba(0, 0, 0, 0.3);
}

.button:active {
box-shadow: none;
-moz-transform: translate3d(-6px, 6px, 0);
-ms-transform: translate3d(-6px, 6px, 0);
-webkit-transform: translate3d(-6px, 6px, 0);
transform: translate3d(-6px, 6px, 0);
}

【讨论】: