简体   繁体   English

Hover 效果不变色

[英]Hover effect not changing color

I have 2 card in my design.我的设计中有 2 张卡。 They both have gradient colors assigned to each of them.他们都有梯度 colors 分配给他们每个人。 I have tried different ways to add a hover effect but for some reason it does not apply.我尝试了不同的方法来添加 hover 效果,但由于某种原因它不适用。 I am not sure what I am missing.我不确定我错过了什么。

html html

<a href="#" class="btn sky">
                <img src="/images/money.png" class="wallet-option-icon" alt="Wallet Icon">
                <span class="wallet-option-text">Wallets</span>
                You can start to use your wallet
            </a>
            <a href="#" class="btn orange">
                <img src="/images/exchange.png" class="wallet-option-icon" alt="Exchange Icon">
                <span class="wallet-option-text">Exchange</span>
                You can start to use our Exchange
            </a>

CSS Code CSS 代码

.btn {
  display: inline-block;
  padding: 10px;
  text-decoration: none;
  font-size: 10px;
  color: azure;
  width: 150px;
  height: 189px;
  border-radius: 10%;
  box-shadow: 11px 10px 21px -1px rgba(41, 40, 40, 0.65);
  -webkit-box-shadow: 11px 10px 21px -1px rgba(41, 40, 40, 0.65);
  -moz-box-shadow: 11px 10px 21px -1px rgba(41, 40, 40, 0.65);
}

.sky {
  
  background-image: linear-gradient(
    160deg,
    #4bd2ee 0%,
    #368df6 50%,
    #2a71fb 100%
  );
  margin: 0 12px 0 0;
}


.orange {
  
  background-image: linear-gradient(
    160deg,
    #f87f00 0%,
    #f98800 50%,
    #faa233 100%
  );
}

.btn:hover {
  background-image: black;
}

black is not a valid value for background-image . black不是background-image的有效值。 You could set it to none and set the background-color to black, or do a solid black linear-gradient, or just set background: black .您可以将其设置为none并将background-color设置为黑色,或者做一个纯黑色线性渐变,或者只设置background: black

Change改变

.btn:hover {
  background: black;
}

 .btn { display: inline-block; padding: 10px; text-decoration: none; font-size: 10px; color: azure; width: 150px; height: 189px; border-radius: 10%; box-shadow: 11px 10px 21px -1px rgba(41, 40, 40, 0.65); -webkit-box-shadow: 11px 10px 21px -1px rgba(41, 40, 40, 0.65); -moz-box-shadow: 11px 10px 21px -1px rgba(41, 40, 40, 0.65); }.sky { background-image: linear-gradient( 160deg, #4bd2ee 0%, #368df6 50%, #2a71fb 100% ); margin: 0 12px 0 0; }.orange { background-image: linear-gradient( 160deg, #f87f00 0%, #f98800 50%, #faa233 100% ); }.btn:hover { background: black; }
 <a href="#" class="btn sky"> <img src="/images/money.png" class="wallet-option-icon" alt="Wallet Icon"> <span class="wallet-option-text">Wallets</span> You can start to use your wallet </a> <a href="#" class="btn orange"> <img src="/images/exchange.png" class="wallet-option-icon" alt="Exchange Icon"> <span class="wallet-option-text">Exchange</span> You can start to use our Exchange </a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM