首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我想要一个事务效果(按钮开始填充从左到右的渐变颜色)在我的按钮上悬停时,

我想要一个事务效果(按钮开始填充从左到右的渐变颜色)在我的按钮上悬停时,
EN

Stack Overflow用户
提问于 2019-07-27 19:35:19
回答 1查看 171关注 0票数 0

我想我的按钮填充渐变颜色悬停与横截面离子效果从左到右,最初的按钮是白色背景旧的答案有相反的效果,我正在寻找的是不一样的我的html代码

代码语言:javascript
复制
<a href="" class="btn-rounded read-more blog-read-more-footer" target="_blank">Read more</a>

我想知道如何使用CSS来实现它。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-27 22:04:25

检查这一条:

代码语言:javascript
复制
    *{
      padding:5px;
    }
    a{
        text-decoration:none !important;
    }
    a:hover{
        text-decoration:none !important;
    }
    .button {
      display: block;
      position: relative;
      padding: 10px 0;
      width: 150px;
      border-radius:5px;
      color: #fff;
      text-align: center;
      background-color: #774df4;
      border: none;
    }
    .button.one:after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 0;
      height: 100%;
      background-color: rgba(255,255,255,0.4);
    	-webkit-transition: none;
    	   -moz-transition: none;
    	        transition: none;
    }
    .button.one:hover:after {
      width: 120%;
      background-color: rgba(255,255,255,0);
      
    	-webkit-transition: all 0.4s ease-in-out;
    	   -moz-transition: all 0.4s ease-in-out;
    	        transition: all 0.4s ease-in-out;
    }

    /* Two */
    .button.two {
      background-repeat: no-repeat;
      background-position: -120px -120px, 0 0;
      
      background-image: -webkit-linear-gradient(
        top left,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.2) 37%,
        rgba(255, 255, 255, 0.8) 45%,
        rgba(255, 255, 255, 0.0) 50%
      );
      background-image: -moz-linear-gradient(
        0 0,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.2) 37%,
        rgba(255, 255, 255, 0.8) 45%,
        rgba(255, 255, 255, 0.0) 50%
      );    
      background-image: -o-linear-gradient(
        0 0,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.2) 37%,
        rgba(255, 255, 255, 0.8) 45%,
        rgba(255, 255, 255, 0.0) 50%
      );
      background-image: linear-gradient(
        0 0,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.2) 37%,
        rgba(255, 255, 255, 0.8) 45%,
        rgba(255, 255, 255, 0.0) 50%
      );
      
      -moz-background-size: 250% 250%, 100% 100%;
           background-size: 250% 250%, 100% 100%;
      
      -webkit-transition: background-position 0s ease;
         -moz-transition: background-position 0s ease;       
           -o-transition: background-position 0s ease;
              transition: background-position 0s ease;
    }

    .button.two:hover {
      background-position: 0 0, 0 0;
      
      -webkit-transition-duration: 0.5s;
         -moz-transition-duration: 0.5s;
              transition-duration: 0.5s;
    }
    
    /* Last Button css starts */

    
    
  .c-button {
  color: #000;
  font-weight: 700;
  font-size: 1em;
  text-decoration: none;
  padding: 0.7em 1.8em;
  cursor: pointer;
  display: inline-block;
}
.c-button--gooey {
  color: #06c8d9;
  font-size: 1.3em;
  letter-spacing: 2px;
      border-radius:5px;
  border: 2px solid #06c8d9;
  padding: 1.2em 3.4em;
  position: relative;
  transition: all 700ms ease;
}
.c-button--gooey .c-button__blobs {
  filter: url(#goo);
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 0;
  bottom: -3px;
  right: -1px;
  z-index: -1;
}
.c-button--gooey .c-button__blobs div {
background:linear-gradient(to right,#61dce4,#0083ef);
width: 100%;
  height: 100%;
  border-radius: 100%;
  position: absolute;
  transform: scale(2) translateX(-250%) translateZ(0);
  transition: all 1.1s ease;
}

.c-button--gooey:hover {
  color: #fff;
}
.c-button--gooey:hover .c-button__blobs div {
  transform: scale(2.4) translateX(15%) translateZ(0);
}
代码语言:javascript
复制
    <br/>
    <a href="#" title="Button One" class="button one">Button 1</a>


    <br />
    <a href="#" title="Button Two" class="button two">BUTTON 2</a>
    <br />

    <input name="" value="Submit" type="submit" class="button two">

<br/>

    <a href=" " class="c-button c-button--gooey">
BUTTON      <div class="c-button__blobs">
        <div></div>
      </div>
    </a>  

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57231729

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档