HTML
CSS
/* FOR CODEPEN PRESENTATION ONLY */
body {font-family: 'open sans'; max-width: 1200px; margin: 60px auto;} .buttons {display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-align-items: flex-start; -ms-flex-align: start; align-items: flex-start;}
/* PASTE BELOW IN CSS */
.buttons * {
transition: all .5s ease;
}
.buttons {
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
/* .butWrap {
position: relative;
list-style: none;
text-align: center;
display: -webkit-flex;
display: -ms-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-align-content: flex-end;
-ms-align-content: end;
align-content: flex-end;
width: 100%;
} */
/* Common style */
.butFrame {
position: relative;
overflow: hidden;
margin: 5px;
width: 24%;
background: #111;
font-family: inherit;
font-size: 1em;
text-align: center;
cursor: pointer;
}
.butFrame .butTextWrap {
font-family: inherit;
padding: 2em;
color: #fff;
text-transform: uppercase;
font-size: 1.25em;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.butFrame .butTextWrap::before,
.butFrame .butTextWrap::after {
pointer-events: none;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
}
.butFrame .butTextWrap,
.butFrame .butTextWrap > a {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* Anchor will cover the whole item by default */
.butFrame .butTextWrap > a {
z-index: 1000;
text-indent: 200%;
white-space: nowrap;
font-size: 0;
opacity: 0;
}
.butFrame .butText {
font-weight: 300;
}
.butFrame {
margin: 0;
color: #fff;
}
/* EFFECT */
.butFrame .butTextWrap::before,
.butFrame .butTextWrap::after {
position: absolute;
top: 10px;
right: 10px;
bottom: 10px;
left: 10px;
content: '';
opacity: 0;
-webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
transition: opacity 0.35s, transform 0.35s;
}
.butFrame .butTextWrap::before {
border-top: 1px solid #fff;
border-bottom: 1px solid #fff;
-webkit-transform: scale(0, 1);
transform: scale(0, 1);
}
.butFrame .butTextWrap::after {
border-right: 1px solid #fff;
border-left: 1px solid #fff;
-webkit-transform: scale(1, 0);
transform: scale(1, 0);
box-sizing: border-box;
}
/* HOVER STYLES */
.butFrame:hover .butTextWrap::before,
.butFrame:hover .butTextWrap::after {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
/* MEDIA QUERIES */
@media all and (max-width: 950px) and (min-width: 701px){
.butFrame {
display:block;
width:47%;
}
}
@media all and (max-width: 700px) and (min-width: 0px){
.butFrame {
display:block;
width:100%;
}
}
https://codepen.io/NetWorkRoom/pen/qLePqX
cho nút ở đây
CSS
/*hiệu ứng nút*/
.butFrame {
position: relative;
overflow: hidden;
margin: 5px;
width: 24%;
background: #111;
font-family: inherit;
font-size: 1em;
text-align: center;
cursor: pointer;
}
.butFrame .butTextWrap {
font-family: inherit;
padding: 0em;
color: #fff;
text-transform: uppercase;
font-size: 1.25em;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.butFrame .butTextWrap::before,
.butFrame .butTextWrap::after {
pointer-events: none;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
}
.butFrame .butTextWrap,
.butFrame .butTextWrap > a {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* Anchor will cover the whole item by default */
.butFrame .butTextWrap > a {
z-index: 1000;
text-indent: 200%;
white-space: nowrap;
font-size: 0;
opacity: 0;
}
.butFrame .butText {
font-weight: 300;
}
.butFrame {
margin: 0;
color: #fff;
}
/* EFFECT */
.butFrame .butTextWrap::before,
.butFrame .butTextWrap::after {
position: absolute;
top: 4px;
right: 5px;
bottom: 4px;
left: 5px;
content: '';
opacity: 0;
-webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
transition: opacity 0.35s, transform 0.35s;
}
.butFrame .butTextWrap::before {
border-top: 1px solid #fff;
border-bottom: 1px solid #fff;
-webkit-transform: scale(0, 1);
transform: scale(0, 1);
}
.butFrame .butTextWrap::after {
border-right: 1px solid #fff;
border-left: 1px solid #fff;
-webkit-transform: scale(1, 0);
transform: scale(1, 0);
box-sizing: border-box;
}
/* HOVER STYLES */
.butFrame:hover .butTextWrap::before,
.butFrame:hover .butTextWrap::after {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
/* MEDIA QUERIES */
@media all and (max-width: 950px) and (min-width: 701px){
.butFrame {
display:block;
width:47%;
}
}
@media all and (max-width: 700px) and (min-width: 0px){
.butFrame {
display:block;
width:100%;
}
}