Untitled

 avatar
unknown
plain_text
6 months ago
777 B
3
Indexable
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Thay đổi kích thước ảnh</title>
<style>
    :root {
        --size: 300px;
    }

    .img{
        width: 300px;
        height: 300px;
    }

    .img.hover{
        width: 500px;
        height: 300px;
    }
</style>
<body>
    <img class="img" src="./Capture.png" alt="">
    <script>
        const img= document.querrySelector('img.img');

        img.addEventListener('mousemover',()=>{
            img.classList.add('hover')
        })
        img.addEventListener('mouseleave',()=>{
            img.classList.remove('hover')
        })
    </script>

    
</body>
</html>
Editor is loading...
Leave a Comment