How to create: image overlay scaling
- Página anterior Deslizar sobreposição de imagem
- Próxima página Título de sobreposição de imagem
Learn how to create an image overlay scaling effect on hover.
Image overlay full-screen scaling
Hover over the image to see the scaling effect.

How to create an overlay scaling effect
First step - Add HTML:
<div class="container"> <img src="img_avatar.png" alt="Avatar" class="image"> <div class="overlay"> <div class="text">Hello World</div> </div> </div>
Second step - Add CSS:
/* The container that needs to place the overlay. Adjust the width as needed */ .container { position: relative; width: 50%; } /* Make the image responsive */ .image { width: 100%; height: auto; } /* Overlay effect (full height and full width) - located at the top of the container and above the image */ .overlay { position: absolute; bottom: 0; left: 0; right: 0; background-color: #008CBA; overflow: hidden; width: 100%; height: 100%; transform: scale(0); transition: .3s ease; } /* The overlay text will 'scale' when the mouse is hovered over the container */ .container:hover .overlay { transform: scale(1); } /* Some text inside the overlay, centered vertically and horizontally */ .text { color: white; font-size: 20px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
Related pages
Tutorial:Imagem CSS
Tutorial:Como criar efeito de sobreposição de imagem ao passar o mouse
- Página anterior Deslizar sobreposição de imagem
- Próxima página Título de sobreposição de imagem