I have the following css3 transition with ease:
HTML
<div class="button"> <a href="#" onMouseOver="clicksound.playclip()"></a> <p id="myId" class="top"></p> </div>
CSS
* { padding: 0; margin: 0; } .button { width: 180px; margin-top: 45px; } .button a { display: block; height: 40px; width: 180px; color: black; font: 17px/50px Helvetica, Verdana, sans-serif; text-decoration: none; text-align: center; text-transform: uppercase; } .button a { background:url(http://imageshack.com/a/img819/761/dqj.gif); margin: -50 0 0 0; z-index: -1; } p#myId { background: url(http://imageshack.com/a/img854/1921/9ft3.png); display: block; height: 40px; width: 167px; margin: -40px 0 0 5px; z-index:-1; text-align: center; font: 12px/45px Helvetica, Verdana, sans-serif; color: #fff; position: absolute; -webkit-transition: margin 0.1s ease; -moz-transition: margin 0.1s ease; -o-transition: margin 0.1s ease; -ms-transition: margin 0.1s ease; transition: margin 0.1s ease; } .button:hover .top { margin: -67px 0 0 5px; line-height: 35px; } .button:active .top { margin: -70px 0 0 5px; }
If I change the p#myId to p in CSS, it works (the button goes up on hover), otherwise it won't.
Running demo on jsFiddle
html css css-selectors css3 css-specificity
023023
source share