transform moves, rotates, scales and skews elements without disturbing the layout around them — which is exactly why it's the go-to for smooth animation. filter and its friends add visual effects like blur, brightness and colour grading.
2D transforms
transform: translateX(20px); /* move right */transform: translate(10px, -5px); /* x, y */transform: rotate(45deg);transform: scale(1.1); /* 110% — a hover zoom */transform: skewX(-10deg);/* Combine several (applied right to left) */transform: translateY(-4px) scale(1.02);/* transform doesn't affect layout — neighbours don't move. */
3D transforms
.scene { perspective: 800px; } /* on the parent — depth of field */.card {transition: transform 0.5s;transform-style: preserve-3d;}.card:hover { transform: rotateY(180deg); } /* a flip card */
Filters
filter: blur(4px);filter: grayscale(100%); /* e.g. a monochrome logo wall */filter: brightness(1.2) contrast(1.1);filter: drop-shadow(0 4px 8px rgb(0 0 0 / 0.2)); /* shadow that follows shape */img:hover { filter: grayscale(0); transition: filter 0.3s; }
backdrop-filter & blend modes
/* Blur whatever is BEHIND the element (frosted-glass effect) */.nav {background: rgb(255 255 255 / 0.7);backdrop-filter: blur(10px);}/* Blend an element with what's behind it */.overlay { mix-blend-mode: multiply; }
Practice
Make an image card that zooms slightly (scale(1.05)) and lifts on hover, with a smooth transition. Build a 3D flip card with rotateY(180deg). Grayscale a logo that colours on hover with filter, and give a sticky nav a backdrop-filter: blur() frosted look.
Key takeaways
- 01transform (translate/rotate/scale/skew) moves elements without affecting layout — ideal for animation.
- 02Combine transforms in one declaration; set transform-origin for the pivot.
- 033D needs perspective on the parent + transform-style: preserve-3d (e.g. flip cards).
- 04filter applies blur, grayscale, brightness, drop-shadow and more.
- 05backdrop-filter blurs what's behind (frosted glass); mix-blend-mode blends layers.
