Fr0stY Fr0stY - 2 years ago 71
HTML Question

How to animate an element on hover

How can I make my

elements grow (and the content changes text size to a higher one), when hovered over? I put them in a class and tried:

size: 150%;


height: +30px;
width: +30px;

the first try didn't work at all, and the second code just made the div's flash and dissappear partially.

Answer Source

CSS3 solution:

div {
    background: #999;
    width: 200px;
    height: 20px; 
    transition: width 1s;

    width: 300px;
    <p>Im content</p>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download