SOURCE

console 命令行工具 X clear

                    
>
console
/*
这个按钮效果就是用的transition实现的,是根据用户行为来改变状态的一个典型例子。
在表现形式上,还是离不开线条的变化,在css中,线条的变化离不开边框,所以这种线条变化的css动画都是拿边框做文章的。
我们看到这个交互效果的时候,可以想象一下如果是我们自己来实现,会有什么样的方法,或者说一个什么样的思路。


*/
<h1>纯 css  按钮 </h1>

<div>
  <button class="button type1">
    <a href="http://www.baidu.com" target="_blank" style="color:#000">跳转按钮</a>
  </button>

  <button class="button type2">
    <a href="http://www.baidu.com"   target="_blank" style="color:#000">跳转按钮</a>
  </button>
  
  <button class="button type3">
     <a href="http://www.baidu.com"   target="_blank" style="color:#000">JSRUN</a>
  </button>
</div>
a{
  text-decoration:none
}
@import url("https://fonts.googleapis.com/css?family=Raleway");
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  font-family: Raleway;
  background-color: #ecf0f1;
}

.copyright {
  position: absolute;
  bottom: 0;
}
.copyright a {
  text-decoration: none;
  color: #16a085;
}
.copyright a:hover {
  text-decoration: underline;
}

.button {
  position: relative;
  padding: 1em 1.5em;
  border: none;
  background-color: transparent;
  cursor: pointer;
  outline: none;
  font-size: 18px;
  margin: 1em 0.8em;
}
.button.type1 {
  color: #566473;
}
.button.type1.type1::after, .button.type1.type1::before {
  content: "";
  display: block;
  position: absolute;
  width: 20%;
  height: 20%;
  border: 2px solid;
  transition: all 0.6s ease;
  border-radius: 2px;
}
.button.type1.type1::after {
  bottom: 0;
  right: 0;
  border-top-color: transparent;
  border-left-color: transparent;
  border-bottom-color: #566473;
  border-right-color: #566473;
}
.button.type1.type1::before {
  top: 0;
  left: 0;
  border-bottom-color: transparent;
  border-right-color: transparent;
  border-top-color: #566473;
  border-left-color: #566473;
}
.button.type1.type1:hover:after, .button.type1.type1:hover:before {
  width: 100%;
  height: 100%;
}
.button.type2 {
  color: #16a085;
}
.button.type2.type2:after, .button.type2.type2:before {
  content: "";
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #16a085;
  transition: all 0.3s ease;
  transform: scale(0.85);
}
.button.type2.type2:hover:before {
  top: 0;
  transform: scale(1);
}
.button.type2.type2:hover:after {
  transform: scale(1);
}
.button.type3 {
  color: #435a6b;
}
.button.type3.type3::after, .button.type3.type3::before {
  content: "";
  display: block;
  position: absolute;
  width: 20%;
  height: 20%;
  border: 2px solid;
  transition: all 0.6s ease;
  border-radius: 2px;
}
.button.type3.type3::after {
  bottom: 0;
  right: 0;
  border-top-color: transparent;
  border-left-color: transparent;
  border-bottom-color: #435a6b;
  border-right-color: #435a6b;
}
.button.type3.type3::before {
  top: 0;
  left: 0;
  border-bottom-color: transparent;
  border-right-color: transparent;
  border-top-color: #435a6b;
  border-left-color: #435a6b;
}
.button.type3.type3:hover:after, .button.type3.type3:hover:before {
  border-bottom-color: #435a6b;
  border-right-color: #435a6b;
  border-top-color: #435a6b;
  border-left-color: #435a6b;
  width: 100%;
  height: 100%;
}