호버 애니메이션 button을 만들려고하는데 앵커 태그에 display : block
을 써도 div를 클릭해도 작동하지 않는 이유를 모르겠습니다.
아래는 내 HTML 및 CSS 코드도 jsfiddle입니다.
HTML :
<div class="animation-button">
<div class="raised hoverable">
<div class="anim"></div><span><a href="index.php?option=com_content&view=about&Itemid=104">More About Us</a></span>
</div>
</div>
CSS :
.animation-button .raised {
position: relative;
margin: 1em;
font-weight: 100;
padding: 10px 19px;
text-align: center;
//min-width:14%;
/*width: 200px;*/
/*border-radius: 5px;*/
overflow: hidden;
position: relative;
z-index: 0;
cursor: pointer;
display: inline-block;
}
.animation-button .raised {
-moz-transition: all 0.1s;
-o-transition: all 0.1s;
-webkit-transition: all 0.1s;
transition: all 0.1s;
background: #849C8E;
box-shadow: 0px 1px 1px #849C8E;
}
.animation-button .raised:active {
background: #70897A;
box-shadow: 0px 1px 1px #70897A;
/* display: inline-block; */
}
.animation-button .raised span a {
font-weight: 400;
font-size: 3vw;
color: #fff;
text-decoration: none;
display: block;
}
.animation-button span a:hover,#ankur span a:focus{
color: #fff;
display: block;
}
.anim {
-moz-transform: translateY(-50%) translateX(-50%);
-ms-transform: translateY(-50%) translateX(-50%);
-webkit-transform: translateY(-50%) translateX(-50%);
transform: translateY(-50%) translateX(-50%);
position: absolute;
top: 50%;
left: 50%;
z-index: -1;
}
.anim:before {
position: relative;
content: '';
display: block;
margin-top: 100%;
}
.anim:after {
content: '';
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
border-radius: 50%;
}
.hoverable:hover > .anim {
-moz-animation: anim-out 0.75s;
-webkit-animation: anim-out 0.75s;
animation: anim-out 0.75s;
}
.hoverable:hover > .anim:after {
-moz-animation: anim-out-pseudo 0.75s;
-webkit-animation: anim-out-pseudo 0.75s;
animation: anim-out-pseudo 0.75s;
}
@-webkit-keyframes anim-in {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@-moz-keyframes anim-in {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@-ms-keyframes anim-in {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@keyframes anim-in {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@-webkit-keyframes anim-in-pseudo {
0% {
background: rgba(0, 0, 0, 0.25);
}
100% {
background: transparent;
}
}
@-moz-keyframes anim-in-pseudo {
0% {
background: rgba(0, 0, 0, 0.25);
}
100% {
background: transparent;
}
}
@-ms-keyframes anim-in-pseudo {
0% {
background: rgba(0, 0, 0, 0.25);
}
100% {
background: transparent;
}
}
@keyframes anim-in-pseudo {
0% {
background: rgba(0, 0, 0, 0.25);
}
100% {
background: transparent;
}
}
@-webkit-keyframes anim-out {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@-moz-keyframes anim-out {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@-ms-keyframes anim-out {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@keyframes anim-out {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@-webkit-keyframes anim-out-pseudo {
0% {
background: rgba(0, 0, 0, 0.25);
}
100% {
background: transparent;
}
}
@-moz-keyframes anim-out-pseudo {
0% {
background: rgba(0, 0, 0, 0.25);
}
100% {
background: transparent;
}
}
@-ms-keyframes anim-out-pseudo {
0% {
background: rgba(0, 0, 0, 0.25);
}
100% {
background: transparent;
}
}
@keyframes anim-out-pseudo {
0% {
background: rgba(0, 0, 0, 0.25);
}
100% {
background: transparent;
}
}
jsfiddle : https://jsfiddle.net/a2zgk/yL8ngrx5/1/