缩放CSS按钮样式

时间:2019-01-27 13:17:27

标签: css css3 button scale

我要使用这种设计:

https://codepen.io/Damian_Kidd/pen/XYXQWw

.circle{
  margin-left: 40px;
  text-decoration: none;
  font-size: 36px;
  color: #6C7686;
  text-shadow: 0 1px 0 rgba(255,255,255,0.29);
  letter-spacing: 6px;
  display: inline-block;
  background: #fff;
  font-family: "open sans";
  font-weight: 600;
  line-height: 250px;
  cursor: pointer;
  transition: all ease-in-out 100ms;
  width: 250px;
  height: 250px;
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(-179deg, #F4F4F4 0%, #C0C0C0 100%);
  box-shadow: 0 5px 6px -4px rgba(0,0,0,0.22), 0 10px 13px -4px rgba(0,0,0,0.34), inset 0 100px 100px 0 rgba(255,255,255,0.35), inset 0 -100px 100px 0 rgba(0,0,0,0.10);
  border-radius: 140px;
}
.circle:hover{
    box-shadow: 0 5px 10px 0px rgba(0,0,0,0.22), 0 10px 13px 0px rgba(0,0,0,0.34), inset 0 18px 18px 0 rgba(255,255,255,0.35), inset 0 -18px 18px 0 rgba(0,0,0,0.10);
  transform: translate(0px, -4px);
  backface-visibility: hidden;
  color: #7A8393;
  }
.circle:active{
  box-shadow: 0 5px 10px 0px rgba(0,0,0,0.22), 0 10px 13px 0px rgba(0,0,0,0.34), inset 0 3px 3px 0 rgba(255,255,255,0.35), inset 0 -3px 3px 0 rgba(0,0,0,0.10);
  backface-visibility: hidden;
  }
<a class="circle">GO</a>

任何人都知道如何为较小的按钮缩放css,比如说25px(第一个圆圈)?

当您更改唯一的宽度/高度时,它将呈现出不同的平滑样式。

1 个答案:

答案 0 :(得分:0)

@arnaudjnn:希望它对您有用!

@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800,900);

html{
  background-color: #F4F4F4;
  height: 100%;
}

body{
  text-align: center;
  padding: 100px;
}
  
.button{
  margin-right: 40px;
  text-decoration: none;
  font-size: 18px;
  color: #6C7686;
  text-shadow: 0 1px 0 rgba(255,255,255,0.29);
  letter-spacing: 6px;
  display: inline-block;
  background: #C0C0C0;
  font-family: "open sans";
  font-weight: 600;
  line-height: 84px;
  cursor: pointer;
/*   transition: all ease-in-out 100ms; */
  transition: all 0.3s linear;
  width: 250px;
  height: 84px;
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(-179deg, #F4F4F4 0%, #C0C0C0 100%);
  box-shadow: 0 5px 6px -4px rgba(0,0,0,0.22), 0 10px 13px -4px rgba(0,0,0,0.34), inset 0 30px 30px 0 rgba(255,255,255,0.35), inset 0 -30px 30px 0 rgba(0,0,0,0.10);
  border-radius: 140px;

}
.button:hover{
    box-shadow: 0 5px 10px 0px rgba(0,0,0,0.22), 0 10px 13px 0px rgba(0,0,0,0.34), inset 0 18px 18px 0 rgba(255,255,255,0.35), inset 0 -18px 18px 0 rgba(0,0,0,0.10);
/*   transform: translate(0px, -4px); */
  transform: scale(1.0);
  backface-visibility: hidden;
  color: #7A8393;
  }
.button:active{
  box-shadow: 0 5px 10px 0px rgba(0,0,0,0.22), 0 10px 13px 0px rgba(0,0,0,0.34), inset 0 3px 3px 0 rgba(255,255,255,0.35), inset 0 -3px 3px 0 rgba(0,0,0,0.10);
  backface-visibility: hidden;

  }

.circle{
  margin-left: 40px;
  text-decoration: none;
  font-size: 36px;
  color: #6C7686;
  text-shadow: 0 1px 0 rgba(255,255,255,0.29);
  letter-spacing: 6px;
  display: inline-block;
  background: #fff;
  font-family: "open sans";
  font-weight: 600;
  line-height: 250px;
  cursor: pointer;
/*   transition: all ease-in-out 100ms; */
    transition: all 0.3s linear;
  width: 250px;
  height: 250px;
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(-179deg, #F4F4F4 0%, #C0C0C0 100%);
  box-shadow: 0 5px 6px -4px rgba(0,0,0,0.22), 0 10px 13px -4px rgba(0,0,0,0.34), inset 0 100px 100px 0 rgba(255,255,255,0.35), inset 0 -100px 100px 0 rgba(0,0,0,0.10);
  border-radius: 140px;
}
.circle:hover{
    box-shadow: 0 5px 10px 0px rgba(0,0,0,0.22), 0 10px 13px 0px rgba(0,0,0,0.34), inset 0 18px 18px 0 rgba(255,255,255,0.35), inset 0 -18px 18px 0 rgba(0,0,0,0.10);
/*   transform: translate(0px, -4px); */
  transform: scale(1.0);
  backface-visibility: hidden;
  color: #7A8393;
  }
.circle:active{
  box-shadow: 0 5px 10px 0px rgba(0,0,0,0.22), 0 10px 13px 0px rgba(0,0,0,0.34), inset 0 3px 3px 0 rgba(255,255,255,0.35), inset 0 -3px 3px 0 rgba(0,0,0,0.10);
  backface-visibility: hidden;

  }
<a href="#" class="button">SMOOTH</a>

<a href="#" class="circle">GO</a>