.box { overflow: hidden; } .box1 { width: 200px; height: 200px; border: 6px solid #ccc; text-align: center; font-size: 40px; line-height: 200px; margin-right: 20px; transform: scale(0.5); transition: 0.3s; float: left; } .box1:hover { transform: scale(0.8); } .box2 { float: left; width: 100px; height: 100px; border: 3px solid #ccc; text-align: center; font-size: 20px; line-height: 100px; transition: 0.3s; margin-top: 50px; } .box2:hover { transform: scale(1.8); }