CSS Image Effects
Images make websites attractive and engaging, but plain images can feel boring. CSS Image Effects let you easily add shadows, borders, filters, hover animations, overlays, and transitions to images — all with just CSS, no Photoshop needed.
Popular CSS Image Effects
Here’s a complete list of commonly used image effects with separate HTML and CSS examples.
Image Hover Zoom Effect
This effect makes the image smoothly zoom in when hovered, creating an interactive and engaging look. Ideal for product images in eCommerce websites.
<img src="image.jpg" alt="Zoom Effect" class="zoom-img">
.zoom-img {
width: 300px;
transition: transform 0.4s ease; /* Smooth animation */
}
.zoom-img:hover {
transform: scale(1.2); /* Zoom in on hover */
}
Image with Drop Shadow
Adds a 3D shadow effect, making images appear elevated and prominent. Shadows are great for emphasizing key visuals.
<img src="image.jpg" alt="Shadow Effect" class="shadow-img">
.shadow-img {
width: 300px;
box-shadow: 8px 8px 20px rgba(0,0,0,0.5); /* X, Y, blur, color */
}
Rounded Image (Circle Effect)
Turns any square or rectangular image into a perfect circle, commonly used for profile pictures or team sections.
<img src="image.jpg" alt="Circle Image" class="circle-img">
.circle-img {
width: 200px;
height: 200px;
border-radius: 50%; /* Circular shape */
object-fit: cover; /* Maintain aspect ratio */
}
Image Overlay Effect
Adds a color overlay with text that appears on hover. Perfect for portfolio projects or interactive image sections.
<div class="overlay-container">
<img src="image.jpg" alt="Overlay Effect">
<div class="overlay">Hello World</div>
</div>
.overlay-container {
position: relative;
width: 300px;
}
.overlay-container img {
width: 100%;
display: block;
}
.overlay {
position: absolute;
bottom: 0;
background: rgba(0,0,0,0.6); /* Semi-transparent overlay */
color: #fff;
width: 100%;
text-align: center;
padding: 15px;
opacity: 0; /* Hidden by default */
transition: opacity 0.3s ease; /* Smooth fade */
}
.overlay-container:hover .overlay {
opacity: 1; /* Show overlay on hover */
}
CSS Filter Effects
Apply blur, grayscale, brightness, sepia, or multiple filters to images. Filters can create dramatic or artistic effects.
<img src="image.jpg" alt="Filter Example" class="filter-img">
.filter-img {
width: 300px;
filter: grayscale(100%) blur(2px) brightness(120%);
transition: filter 0.3s ease;
}
.filter-img:hover {
filter: none; /* Reset filters on hover */
}
Image Border Effect
Stylish border and frame effects help images stand out and match your brand colors.
<img src="image.jpg" alt="Border Effect" class="border-img">
.border-img {
width: 300px;
border: 10px solid #ff5733; /* Border color and thickness */
border-radius: 15px; /* Rounded corners */
}
Image Rotation on Hover
Rotates the image slightly on hover for an interactive and playful effect. Works well in blogs, portfolios, and galleries.
<img src="image.jpg" alt="Rotate Effect" class="rotate-img">
.rotate-img {
width: 300px;
transition: transform 0.4s ease;
}
.rotate-img:hover {
transform: rotate(10deg); /* Rotate image on hover */
}
Image Opacity Hover
Changes the transparency of an image when hovered. Often used for clickable images or banners.
<img src="image.jpg" alt="Opacity Effect" class="opacity-img">
.opacity-img {
width: 300px;
transition: opacity 0.3s ease;
}
.opacity-img:hover {
opacity: 0.6; /* Make image semi-transparent on hover */
}