CSS3-按钮

 按钮颜色

        .button1 {background-color: #4CAF50;} /* Green */

  按钮大小

         .button1 {font-size: 10px;}

  圆角按钮

         .button1 {border-radius: 2px;}

  按钮阴影

         box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);

  禁用按钮

         .disabled {
    opacity: 0.6;
    cursor: not-allowed;

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>按钮</title> 
<style>
.button {
  display: inline-block;
  /*边框*/
  border-radius: 4px;
  /*背景*/
  background-color: #f4511e;
  border: none;
  color: #FFFFFF;
  text-align: center;
  /*大小*/
  font-size: 28px;
  padding: 20px;
  width: 200px;
  transition: all 0.5s;
  cursor: pointer;
  margin: 5px;
  /*阴影*/
  box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}

.button span {
  cursor: pointer;
  display: inline-block;
  position: relative;
  transition: 0.5s;
}

.button span:after {
  content: '»';
  position: absolute;
  opacity: 0;
  top: 0;
  right: -20px;
  transition: 0.5s;
}

.button:hover span {
  padding-right: 25px;

}

.button:hover span:after {
  opacity: 1;
  right: 0;
}
/*禁用按钮*/
.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.button2 {
    position: relative;
    background-color: #4CAF50;
    border: none;
    font-size: 28px;
    color: #FFFFFF;
    padding: 20px;
    width: 200px;
    text-align: center;
    -webkit-transition-duration: 0.4s; /* Safari */
    transition-duration: 0.4s;
    text-decoration: none;
    overflow: hidden;
    cursor: pointer;
}
.button2:after {
    content: "";
    background: #90EE90;
    display: block;
    position: absolute;
    padding-top: 300%;
    padding-left: 350%;
    margin-left: -20px!important;
    margin-top: -120%;
    opacity: 0;
    transition: all 0.8s
}

.button2:active:after {
    padding: 0;
    margin: 0;
    opacity: 1;
    transition: 0s
}
/*下压特效*/
.button3 {
  display: inline-block;
  padding: 15px 25px;
  font-size: 24px;
  cursor: pointer;
  text-align: center;   
  text-decoration: none;
  outline: none;
  color: #fff;
  background-color: #4CAF50;
  border: none;
  border-radius: 15px;
  box-shadow: 0 9px #999;
}

.button3:hover {background-color: #3e8e41}

.button3:active {
  background-color: #3e8e41;
  box-shadow: 0 5px #666;
  transform: translateY(4px);
}
</style>
</head>
<body>

<h2>按钮</h2>

<button class="button" style="vertical-align:middle"><span>Hover </span></button>
<button class="button disabled" style="vertical-align:middle">按钮禁用</button>
<button class="button2" style="vertical-align:middle">点击特效</button>
<button class="button3" style="vertical-align:middle">下压特效</button>
</body>
</html>

 

转载于:https://www.cnblogs.com/minchao/p/6088769.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值