【JavaScript】六种css3按钮特效

1.悬停光环

	* {padding:0; margin:0}
    .box .input {
      position: relative;
      width: 50px;
      background: lightblue;
      color: #ffffff;
      border: none;
      cursor: pointer;
      padding: 5px 10px;
      border-radius: 4px;
      margin: 50px 50px;
      overflow: hidden;
    }
    .box .input:hover{
      background: lightblue;
    }
    .box .input::after{
      content: '';
      position: absolute;
      width: 12px;
      height: 200%;
      top: -100%;
      left: -50%;
      background: rgba(225,225,225,0.45);
      transform: translate3d(-300%,0,0) rotate(35deg);
    }
    .box .input:hover::after{
      transition: transform 1s ease-in-out;
      transform: translate3d(800%, 50%, 0) rotate(35deg);
    }

2.箭头

    * {margin:0; padding:0;}
    .effect.effect-1 {
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
  background: rgb(15, 174, 236);
}
.effect {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  text-transform: capitalize;
  font-family: 'Roboto', sans-serif;
  font-size: 18px;
  padding: 20px 0px;
  width: 150px;
  border-radius: 6px;
  overflow: hidden;
  left: 50px;
  right: 50px;
  position: absolute;
  text-align: center;
}
.effect.effect-1:before {
  content: "←";
  font-family: FontAwesome;
  font-size: 15px;
  position: absolute;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  right: 0;
  top: 0;
  opacity: 0;
  height: 100%;
  width: 40px;
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
}
.effect.effect-1:hover {
  text-indent: -20px;
}
.effect.effect-1:hover:before {
  opacity: 1;
  text-indent: 0px;
}
<a class="effect effect-1" href="#" title="Learn More">Learn More</a>
    * {margin:0; padding:0;}
    .effect.effect-2 {
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
  background: rgb(15, 174, 236);
}
.effect {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  text-transform: capitalize;
  font-family: 'Roboto', sans-serif;
  font-size: 18px;
  padding: 20px 0px;
  width: 150px;
  border-radius: 6px;
  overflow: hidden;
  left: 50px;
  right: 50px;
  position: absolute;
  text-align: center;
}
.effect.effect-2:before {
  content: "good";
  font-family: FontAwesome;
  font-size: 15px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  position: absolute;
  top: 0;
  right: -30px;
  width: 30px;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 0px 6px 6px 0px;
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
  text-align: center;
}
.effect.effect-2:hover {
  text-indent: -30px;
}
.effect.effect-2:hover:before {
  right: 0;
  text-indent: 0px;
}
<a class="effect effect-2" href="#" title="Learn More">Learn More</a>
    * {margin:0; padding:0;}
    .effect.effect-3 {
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
  background: rgb(15, 174, 236);
}
.effect {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  text-transform: capitalize;
  font-family: 'Roboto', sans-serif;
  font-size: 18px;
  padding: 20px 0px;
  width: 150px;
  border-radius: 6px;
  overflow: hidden;
  left: 50px;
  right: 50px;
  position: absolute;
  text-align: center;
}
.effect.effect-3:before {
  content: "by Catci";
  font-family: FontAwesome;
  position: absolute;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  position: absolute;
  top: 100%;
  left: 0px;
  width: 100%;
  height: 100%;
  text-align: center;
  font-size: 30px;
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
}
.effect.effect-3:hover {
  text-indent: -9999px;
}
.effect.effect-3:hover:before {
  top: 0;
  text-indent: 0;
}
<a class="effect effect-3" href="#" title="Learn More">Learn More</a>
    * {margin:0; padding:0;}
    .effect.effect-4 {
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
  background: rgb(15, 174, 236);
}
.effect {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  text-transform: capitalize;
  font-family: 'Roboto', sans-serif;
  font-size: 18px;
  padding: 20px 0px;
  width: 150px;
  border-radius: 6px;
  overflow: hidden;
  left: 50px;
  right: 50px;
  position: absolute;
  text-align: center;
}
.effect.effect-4:before {
  content: "By Catci";
  font-family: FontAwesome;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  position: absolute;
  top: 0;
  left: 0px;
  width: 100%;
  height: 100%;
  text-align: center;
  font-size: 30px;
  -webkit-transform: scale(0, 1);
          transform: scale(0, 1);
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
}
.effect.effect-4:hover {
  text-indent: -9999px;
}
.effect.effect-4:hover:before {
  -webkit-transform: scale(1, 1);
          transform: scale(1, 1);
  text-indent: 0;
}
<a class="effect effect-4" href="#" title="Learn More">Learn More</a>
* {margin:0; padding:0;}
    .effect.effect-5 {
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
  background: rgb(15, 174, 236);
}
.effect {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  text-transform: capitalize;
  font-family: 'Roboto', sans-serif;
  font-size: 18px;
  padding: 20px 0px;
  width: 150px;
  border-radius: 6px;
  overflow: hidden;
  left: 50px;
  right: 50px;
  position: absolute;
  text-align: center;
}
.effect.effect-5 {
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
}
.effect.effect-5:before {
  content: "\f054";
  font-family: FontAwesome;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  position: absolute;
  top: 0;
  left: 0px;
  height: 100%;
  width: 30px;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 0 50% 50% 0;
  -webkit-transform: scale(0, 1);
          transform: scale(0, 1);
  -webkit-transform-origin: left center;
          transform-origin: left center;
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
}
.effect.effect-5:hover {
  text-indent: 30px;
}
.effect.effect-5:hover:before {
  -webkit-transform: scale(1, 1);
          transform: scale(1, 1);
  text-indent: 0;
}
<a class="effect effect-5" href="#" title="Learn More">Learn More</a>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值