css3 - Trying to make a CSS button that grows on hover, with text remaining the same size -


page buttons here: http://teamcherry.com.au/jam-games/

the effect i'm trying achieve links on page button expands when hovered, text remaining same size, , text staying in same position on screen (so button doesn't appear 'move' when changing size).

after researching while, i've managed achieve desired effect using below css, changes padding margin on hover using css transition:

a.btn {     display: inline-block;     background-color: #d11b34;     color: #fff;     text-decoration: none;     font-size: 20px;     padding: 10px;     padding-right: 20px;     padding-left: 20px;     -webkit-border-radius: 15px;     -moz-border-radius: 15px;     border-radius: 15px;         transition: 0.3s ease 0s; }  a.btn:hover {     background-color: #a61529;     padding: 15px;     padding-right: 25px;     padding-left: 25px;     margin: -5px; } 

this achieves effect, effect super jittery when animating in chrome (and possibly other browsers) , button seems quiver when hovering.

is there way achieve precise effect without animation jittering? ideally in pure css if js or jq required that's i'll use.

use hardware acceleration , add bit more time animation (you can adjust if needed) , looks nice. can use ease-in-out smoother effect. tested in ff , chrome

a.btn { display: inline-block; background-color: #d11b34; color: #fff; text-decoration: none; font-size: 20px; padding: 10px; padding-right: 20px; padding-left: 20px; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; transition: 0.6s ease; -webkit-transform: translate3d(0,0,0); -moz-transform: translate3d(0,0,0); -ms-transform: translate3d(0,0,0); -o-transform: translate3d(0,0,0); transform: translate3d(0,0,0); } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -