html - Lateral shake on div hover(CSS3 only) -


still embarking on css3 adventure! i'm trying shake div left , right on hover subtly. believe have of markup , styles correct it's not firing. love insight this. appreciated.

code follows.

<div class="brief-boxes">         <div class="details-box">             <div class="stats">                 <p class="number">1</p>                 <p class="stat-title">title</p>             </div>         </div>          <div class="details-box">             <div class="stats">                 <p class="number">2</p>                 <p class="stat-title">title</p>             </div>         </div>          <div class="details-box">             <div class="stats">                 <p class="number">3</p>                 <p class="stat-title">title</p>             </div>         </div> </div>  .brief-boxes {width:100%;}     .brief-boxes .details-box {color:#fff; float:left; width:32.7%;padding:10px; margin-top:15px;/*min-height:100px;*/ background-color:yellow;}     .brief-boxes:after {clear:both;display:block;content:'';}     .brief-boxes .details-box .stats .number {font-size:40px;}     .brief-boxes .details-box .stats .stat-title {} 

css3 animations:

.details-box:hover {   animation: shake .5s ease-in-out; } @keyframes shake {   0% {     transform: translatex(0);   }    20% {     transform: translatex(-10px);   }    40% {     transform: translatex(10px);   }    60% {     transform: translatex(-10px);   }    80% {     transform: translatex(10px);   }    100% {     transform: translatex(0);   } } 

again thank time.

are viewing code in webkit browser chrome? need make sure include appropriate browser prefixes:

.brief-boxes {width:100%;}      .brief-boxes .details-box {color:#fff; float:left; width:32.7%;padding:10px; margin-top:15px;/*min-height:100px;*/ background-color:yellow;}      .brief-boxes:after {clear:both;display:block;content:'';}      .brief-boxes .details-box .stats .number {font-size:40px;}      .brief-boxes .details-box .stats .stat-title {}    .details-box:hover {    -webkit-animation: shake .5s ease-in-out;    animation: shake .5s ease-in-out;  }  @-webkit-keyframes shake {    0% {      -webkit-transform: translatex(0);    }      20% {      -webkit-transform: translatex(-10px);    }      40% {      -webkit-transform: translatex(10px);    }      60% {      -webkit-transform: translatex(-10px);    }      80% {      -webkit-transform: translatex(10px);    }      100% {      -webkit-transform: translatex(0);    }  }  @keyframes shake {    0% {      transform: translatex(0);    }      20% {      transform: translatex(-10px);    }      40% {      transform: translatex(10px);    }      60% {      transform: translatex(-10px);    }      80% {      transform: translatex(10px);    }      100% {      transform: translatex(0);    }  }
<div class="brief-boxes">          <div class="details-box">              <div class="stats">                  <p class="number">1</p>                  <p class="stat-title">title</p>              </div>          </div>            <div class="details-box">              <div class="stats">                  <p class="number">2</p>                  <p class="stat-title">title</p>              </div>          </div>            <div class="details-box">              <div class="stats">                  <p class="number">3</p>                  <p class="stat-title">title</p>              </div>          </div>  </div>

caniuse great resource determining if need include browser prefixes.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -