Animated 404 Face β Creative SVG Error Page with CSS Animations
CodewithLord
October 4, 2025
This Animated 404 Error Page creatively transforms the digits β404β into a playful, expressive face using SVG paths and CSS animations.
π§ Description
This Animated 404 Error Page creatively transforms the digits β404β into a playful, expressive face using SVG paths and CSS animations.
Each element of the face β eyes, pupils, mouth, and nose β animates dynamically to give the illusion that the β404β is alive: it looks around, blinks, and smiles.
The design uses no JavaScript, relying solely on SVG graphics and CSS keyframes for smooth, lightweight motion.
π» HTML Code
1<!DOCTYPE html>2<htmllang="en">34<head>5<metacharset="UTF-8">6<title>404 Error Face</title>7<metaname="viewport"content="width=device-width, initial-scale=1, viewport-fit=cover"><linkrel="stylesheet"href="./style.css">89</head>1011<body>12<main>13<svgclass="face"viewBox="0 0 320 380"width="320px"height="380px"aria-label="A 404 becomes a face, looks to the sides, and blinks. The 4s slide up, the 0 slides down, and then a mouth appears.">14<g15fill="none"16stroke="currentcolor"17stroke-linecap="round"18stroke-linejoin="round"19stroke-width="25"20 >21<gclass="face__eyes"transform="translate(0, 112.5)">22<gtransform="translate(15, 0)">23<polylineclass="face__eye-lid"points="37,0 0,120 75,120" />24<polylineclass="face__pupil"points="55,120 55,155"stroke-dasharray="35 35" />25</g>26<gtransform="translate(230, 0)">27<polylineclass="face__eye-lid"points="37,0 0,120 75,120" />28<polylineclass="face__pupil"points="55,120 55,155"stroke-dasharray="35 35" />29</g>30</g>31<rectclass="face__nose"rx="4"ry="4"x="132.5"y="112.5"width="55"height="155" />32<gstroke-dasharray="102 102"transform="translate(65, 334)">33<pathclass="face__mouth-left"d="M 0 30 C 0 30 40 0 95 0"stroke-dashoffset="-102" />34<pathclass="face__mouth-right"d="M 95 0 C 150 0 190 30 190 30"stroke-dashoffset="102" />35</g>36</g>37</svg>38</main>3940</body>4142</html>43<!DOCTYPE html>44<htmllang="en">4546<head>47<metacharset="UTF-8">48<title>404 Error Face</title>49<metaname="viewport"content="width=device-width, initial-scale=1, viewport-fit=cover"><linkrel="stylesheet"href="./style.css">5051</head>5253<body>54<main>55<svgclass="face"viewBox="0 0 320 380"width="320px"height="380px"aria-label="A 404 becomes a face, looks to the sides, and blinks. The 4s slide up, the 0 slides down, and then a mouth appears.">56<g57fill="none"58stroke="currentcolor"59stroke-linecap="round"60stroke-linejoin="round"61stroke-width="25"62 >63<gclass="face__eyes"transform="translate(0, 112.5)">64<gtransform="translate(15, 0)">65<polylineclass="face__eye-lid"points="37,0 0,120 75,120" />66<polylineclass="face__pupil"points="55,120 55,155"stroke-dasharray="35 35" />67</g>68<gtransform="translate(230, 0)">69<polylineclass="face__eye-lid"points="37,0 0,120 75,120" />70<polylineclass="face__pupil"points="55,120 55,155"stroke-dasharray="35 35" />71</g>72</g>73<rectclass="face__nose"rx="4"ry="4"x="132.5"y="112.5"width="55"height="155" />74<gstroke-dasharray="102 102"transform="translate(65, 334)">75<pathclass="face__mouth-left"d="M 0 30 C 0 30 40 0 95 0"stroke-dashoffset="-102" />76<pathclass="face__mouth-right"d="M 95 0 C 150 0 190 30 190 30"stroke-dashoffset="102" />77</g>78</g>79</svg>80</main>8182</body>8384</html>85
The structure of the page is built around an SVG graphic, which visually represents the β404β number as a cartoon face.
Whatβs Happening:
The SVG polyline and path elements form the outline of facial features.
The two β4βs are shaped like eyes, and the β0β becomes a nose or central feature.
Each part (eyes, pupils, mouth, nose) has its own CSS animation to bring the face to life.
The result: The 404 error number literally βlooks around, blinks, and smiles.β
he entire animation logic is handled by CSS only β no JavaScript!
π§± Base Styling
Global resets using * and consistent sizing.
Color variables defined using HSL (--light, --dark) for easy dark/light theme switching.
color-scheme: light dark; allows the design to adapt automatically to system theme (light/dark mode).
The page uses CSS Grid to center the SVG perfectly both vertically and horizontally.
π Light & Dark Theme
The light-dark() CSS function smartly adjusts background and text color based on userβs system theme β creating an adaptive interface automatically.