<div class="scale">Hover to Scale With CSS</div>
<div class="scale-js">Hover to Scale With JS</div>
div {
width: 100px;
height: 100px;
background-color: orange;
margin: 20px;
}
.scale:hover {
transform: scale(1.5);
}
const box = document.querySelector('.scale-js');
box.addEventListener('mouseover', function() {
this.style.transform = 'scale(1.5)';
});
box.addEventListener('mouseout', function() {
this.style.transform = 'scale(1)';
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.