This page assumes you're solid on layout — flexbox, grid basics, positioning, and pseudo-classes. If any of that feels shaky, it's worth going back to CSS Intermediate first. What's here builds directly on top of it.
Everything up to this point has been about arranging and styling what's already there. This page gets into the stuff that makes a site feel genuinely dynamic and professional — real animations, layouts that adapt to any screen size, and understanding why CSS sometimes does the exact opposite of what you told it to do.
Here's what's ahead on this page.
Transitions (from Intermediate) only animate between two states — normal and hover, for example. Animations go further, letting you define multiple steps in between, and they can run automatically without needing any user interaction at all.
@keyframes defines what the animation actually does at
different points — think of each keyframe as a checkpoint the
element passes through.
@keyframes slidein {
from {
transform: translateX(-100%);
}
to {
transform: translateX(0);
}
}
.box {
animation: slidein 1s ease-in-out;
}
This tells the browser: use the slidein keyframes, run
it over 1 second, with an ease-in-out pacing.
Instead of just from/to, you can use
percentages for more control over the animation's path.
@keyframes bounce {
0% { transform: translateY(0); }
50% { transform: translateY(-20px); }
100% { transform: translateY(0); }
}
.ball {
animation: bounce 0.6s infinite;
}
infinite makes the animation repeat forever, instead of
just running once.
animation-duration — how long one cycle takesanimation-timing-function — the pacing (same options as transitions)animation-delay — waits before startinganimation-iteration-count — how many times it repeats (or infinite)animation-direction — whether it reverses on alternate cycles@keyframes defines the steps of an animationanimation property applies it to an elementinfinite makes an animation loop foreverResponsive design means your page adapts to whatever screen it's viewed on — phone, tablet, or desktop — instead of looking broken or tiny on smaller screens.
A media query lets you apply CSS rules only when certain conditions are met — most commonly, screen width.
@media (max-width: 768px) {
.sidebar {
display: none;
}
}
This says: "if the screen is 768px wide or narrower, hide the sidebar." Above that width, the rule simply doesn't apply.
max-width — applies the rule at that width and below (targeting smaller screens)min-width — applies the rule at that width and above (targeting larger screens)@media (min-width: 1024px) {
.container {
max-width: 1000px;
margin: 0 auto;
}
}
There's no official rule for these, but a lot of projects roughly follow:
Mobile-first means you write your base styles for small screens,
then use min-width queries to add complexity as the
screen grows. This tends to keep things simpler, since mobile layouts
are usually the more stripped-down version anyway.
Using flexible units like %, vw, and
rem (from Intermediate) alongside media queries makes a
layout adapt more smoothly, rather than relying purely on fixed
breakpoints.
max-width targets smaller screens, min-width targets larger onesThink you've got CSS down? Test yourself!
Start Quiz →