When I hover over the DIV, it grows both in height and in width, but I have no idea how to make it animating smoother, rather than resizing it at the same time
function chg() { document.getElementById("d1").innerHTML="Great Job!"; document.getElementById("d1").style.width="300px"; document.getElementById("d1").style.height="200px"; } function chg2() { document.getElementById("d1").innerHTML="Hover Over Me!"; document.getElementById("d1").style.width="230px"; document.getElementById("d1").style.height="160px"; }
div { background-color:RGB(177,0,0); color:white; font-size:large; height:160px; width:230px; text-align:center; line-height:150px; }
<!DOCTYPE html> <html> <body> <div onmouseover="chg()" onmouseout="chg2()" id="d1">Hover Over Me!</div> </body> </html>
source share