CSS Examples Library

82 examples · all runnable online, source viewable, free to download

Application-level CSS examples — more than syntax demos: complete, ready-to-use pieces with polished UI and combined fundamentals. Preview live, copy the source, or download every example. Pair it with the CSS tutorial and reference manual for systematic learning.

Category:
Gradient Glow Button
Gradient Glow ButtonThree pure-CSS gradient buttons: linear-gradient fills, a glowing box-shadow that lifts on hover, and a ::before shine band sweeping across. Zero JavaScript — gradients, shadows and transitions working together.⚡ Intermediate#background#box-shadow#transition
3D Press Button
3D Press ButtonA solid box-shadow acts as the button's side; on :active the button translates down onto its own shadow for instant 3D feel. Includes :focus-visible styling — a classic no-JS interaction pattern.🔥 Advanced#box-shadow#transform#transition
Hover Reveal Card
Hover Reveal CardA profile card: circular avatar over a gradient banner; on hover the card lifts and a hidden stats panel fades in. Animated with opacity + transform, keyboard-friendly via :focus-within, written in logical properties so it is RTL-safe.🔥 Advanced#transform#transition#box-shadow
Pure CSS Loaders
Pure CSS LoadersFour classic loading indicators on one page: spinning ring, bouncing dots, indeterminate bar and breathing pulse — all driven by @keyframes alone, no JavaScript and no images. A must-study for animation timing and staggered delays.⚡ Intermediate#animation#border-radius#transform
Pill Hover Navbar
Pill Hover NavbarA dark navbar: Flexbox menu with a pill highlight on hover and a ::after underline sliding out from the center via scaleX; aria-current marks the active page. A hands-on piece for flex layout plus pseudo-element animation.🔥 Advanced#flex#position#transition
Outline Slide Button
Outline Slide ButtonTransparent outline buttons whose theme color slides up from the bottom on hover while the text flips to white — a one-line background-size 0%→100% fill with a strong sense of direction.⚡ Intermediate#background#transition#border
Neon Glow Button
Neon Glow ButtonThree neon buttons on a dark stage: transparent fill, bright outlines, and twin text/box-shadow glows breathing on offset @keyframes delays. The signature example for layering shadows into a neon-tube look.🔥 Advanced#box-shadow#text-shadow#animation
3D Flip Card
3D Flip Cardperspective sets the 3D depth, rotateY(180deg) flips the card, and backface-visibility: hidden keeps both faces in place — the three-piece combo behind every glitch-free flip card, and the essential intro to 3D transforms.🔥 Advanced#transform#transform-style#backface-visibility
Glassmorphism Card
Glassmorphism CardColorful gradient blobs set the stage while the card gets frosted with backdrop-filter: blur — translucent fill, thin bright border and a soft large shadow. The core recipe of the glassmorphism trend on one page.🔥 Advanced#backdrop-filter#background#box-shadow
Pure CSS Hamburger Menu
Pure CSS Hamburger MenuA hidden checkbox plus a label-drawn hamburger: click to slide the drawer in and reveal the overlay, click again to close — the classic checkbox hack that decodes most zero-dependency menus on the web.🔥 Advanced#position#transition#selectors
Hover-Expand Sidebar
Hover-Expand SidebarThe classic dashboard rail: icons only until hover expands it from 64px to 220px with labels fading in and the active item highlighted — a small finished piece for practicing transition with fixed positioning.⚡ Intermediate#position#flex#transition
Skeleton Screen
Skeleton ScreenGray placeholders before content arrives: avatar ring, text lines and an image block in position while a linear-gradient highlight sweeps across. The modern app's trick for perceived speed, shown next to a loaded card.⚡ Intermediate#animation#background
conic-gradient Progress Ring
conic-gradient Progress RingA conic-gradient paints an angle-filled ring; cap it with an inner circle and it becomes a progress bar. Rotation plus a pulsing percentage in the center — no SVG, no canvas, one gradient.🔥 Advanced#background#animation#transform
Floating Label Inputs
Floating Label InputsThe label starts living inside the input, then shrinks, floats up and turns theme-colored on :focus or once :placeholder-shown no longer matches — Material Design's signature interaction and the classic pure-CSS way to detect user input.⚡ Intermediate#transition#transform#background
Pure CSS Toggle Switch
Pure CSS Toggle SwitchStrip the checkbox with appearance: none and redraw it entirely: a pill track with a round knob that changes track color and slides across on :checked. A settings-page staple and the best exercise for the appearance property.🔥 Advanced#appearance#transition#selectors
Split-Screen Login Page
Split-Screen Login PageA full-page flex split: gradient brand panel with a slogan on one side, clean form panel on the other, and the brand column auto-hides on narrow screens. The most-used login layout in real products — a complete flex two-column, responsive exercise.🎯 Full Project#flex#background#box-shadow
Glass Login Card
Glass Login CardA deep violet-blue gradient with floating blobs sets the mood while the login card frosts over: translucent inputs, bright borders and a glowing button. A complete mini-page applying glassmorphism to a real scenario.🔥 Advanced#backdrop-filter#box-shadow#border-radius
Gradient Text
Gradient TextThe three-piece combo that paints text with a gradient: background gradient + background-clip: text + color: transparent. Two differently styled headline blocks side by side — the finishing touch for hero typography.⚡ Intermediate#background#background-clip#color
Typewriter Effect
Typewriter EffectA command types itself out in a terminal window: width driven by steps(), clipped by overflow: hidden, with a blinking ::after cursor. The most classic real-world use of the steps() easing function — essential for developer-style pages.🔥 Advanced#animation#animation-timing-function#white-space
Glitch 404 Page
Glitch 404 PageA giant 404 with cyan/magenta ghosts: ::before and ::after each carry clip-path bands shaken by steps() into a broken-signal feel. A clip-path × steps() showpiece — the kind of 404 visitors remember.🔥 Advanced#animation#clip-path#text-shadow
Night-Sky 404 Scene
Night-Sky 404 SceneA full-page night-sky gradient: a pure-CSS moon with halo, stars blinking on offset delays, and two mountain silhouettes grounding the scene around a 404 message — scene illustration with zero images, exercising gradients, positioning and animation together.🎯 Full Project#background#position#animation
Status Dot Badge
Status Dot BadgePresence for contact lists and support panels: a three-state dot pinned to the avatar corner (online/away/offline), with the online dot breathing a box-shadow halo — a tiny component with outsized presence, and great shadow/animation practice.⚡ Intermediate#animation#box-shadow#border-radius
Notification Badge
Notification BadgeRed count badges pinned to bell, message and cart icons: absolutely positioned over the corner, popping in with a scale bounce, capped at 99+. The everyday absolute+transform pattern and a starting point for recreating app UI.⚡ Intermediate#position#transform#border-radius
Three-Column Pricing
Three-Column PricingThe SaaS-website staple: three cards in a row with the recommended one highlighted — accent border, 10px lift, stronger shadow and a top badge — reflowing to a column on narrow screens. The standard answer for flex card alignment, emphasis states and responsiveness.🔥 Advanced#flex#box-shadow#transform
Compact Pricing Card
Compact Pricing CardA single horizontal card in three sections: plan name and price on the left, two columns of features in the middle, a call-to-action on the right, one footnote below — compact pricing for tight spaces (modals, sidebars) and a neat flex three-section template.⚡ Intermediate#flex#border#background
Icon Slide Button
Icon Slide ButtonOn hover the arrow slides into the button while padding makes room in one smooth motion — transition driving both padding and icon shift, the most restrained way to make a button move.⚡ Intermediate#background#transition#flex
Social Login Buttons
Social Login ButtonsFour full-width social buttons — GitHub, Google, Facebook and X: instantly recognizable brand colors with a subtle hover deepen. The staple of every login page, and a lesson in organizing brand-color variables.⚡ Intermediate#background#border-radius#transition
Button Loading State
Button Loading StatePress the button and the label yields to a spinning loader — a pure-CSS loading state on :active. Real submit flows need JS, but this example nails the half that CSS owns: state switching without layout jumps.🔥 Advanced#animation#border-radius#transition
Testimonial Card
Testimonial CardOversized quote mark, testimonial text, a five-star rating and an avatar signature — the trust component of every landing page, and a clear lesson in typographic hierarchy.⚡ Intermediate#box-shadow#border-radius#flex
Article Preview Card
Article Preview CardThe standard blog card: gradient cover, category badge, title, excerpt and a date/read-time row; on hover the card lifts while the cover zooms slightly inside overflow: hidden — the classic overflow × transform pairing.⚡ Intermediate#background#border-radius#box-shadow
Team Member Grid
Team Member GridFour member cards in a two-column grid, each revealing a social row on hover — grid layout plus independent per-card hover choreography, a ready-made skeleton for About pages.🔥 Advanced#grid#transition#background
Breadcrumb Navigation
Breadcrumb NavigationHome / Category / Subcategory / Current page — the hierarchy at a glance, current page bold and non-clickable. A small, correct, SEO-friendly component where aria-labels and separator semantics are the fine points.⚡ Intermediate#flex#transition#background
Pagination Nav
Pagination Nav‹ 1 2 3 … 8 ›: current page as a solid pill, disabled arrows grayed out, ellipsis bridging the gap — the must-have pager that covers clickable, active and disabled states in one example.⚡ Intermediate#flex#border-radius#transition
Multi-Column Footer
Multi-Column FooterA complete footer — brand column, three link columns and a copyright row: grid for the layout, tasteful link typography and hover brightening. The facade component every serious site needs, and the one whose structure is most worth copying.🔥 Advanced#grid#background#padding
Chat Typing Dots
Chat Typing DotsThree dots bouncing in turn inside a chat bubble — the universal 'typing…' signal. One keyframe plus staggered delays makes the wave, with a real message bubble for context.⚡ Intermediate#animation#border-radius
Equalizer Loader
Equalizer LoaderFive bars dancing like sound waves: scaleY with transform-origin decides where each bar grows from, staggered delays draw the wave. The signature motion of audio players — and a hands-on scaleY-vs-translate comparison.⚡ Intermediate#animation#transform
Success Check Animation
Success Check AnimationThe moment a submit succeeds: the disc pops in and an inline-SVG check draws itself via stroke-dashoffset falling to zero. stroke-dasharray/dashoffset is the most underrated combo in CSS animation — master it and every 'line grows' effect is yours.🔥 Advanced#animation#transform
Search Bar Form
Search Bar FormA large rounded search input: the border lights up and the shadow spreads on focus, with a kbd-styled Ctrl K hint on the side — the standard input of docs sites and dashboards, all about focus-state layering.⚡ Intermediate#background#border-radius#transition
OTP Code Inputs
OTP Code InputsThe six-box OTP input for SMS/email codes: uniform squares with focused-cell highlight and inputmode=numeric to summon the number pad. Pure CSS owns the looks and focus states — the auto-advance JS boundary is called out explicitly.🔥 Advanced#letter-spacing#width#text-align
Inline Form Validation
Inline Form Validation:valid/:invalid paired with :placeholder-shown gives 'stay quiet until typed, speak up when wrong': a green ✓ floats in for a legal email, a red ✗ plus border for an illegal one — a validation state machine in pure CSS.🔥 Advanced#selectors#transition#border-color
Centered Minimal Login
Centered Minimal LoginA small centered card on a white page: logo, welcome line, two fields, one button, one forgot-password link — minimalism pushed to its best, where spacing rhythm matters more than any decoration.⚡ Intermediate#box-shadow#border-radius#flex
Social Login Panel
Social Login PanelEmail login first, an 'or' divider, three social buttons below — the standard modern login layout, with a divider trick worth remembering: flex plus borders that stretch to fill.⚡ Intermediate#background#border#transition
Dark Elegant Login
Dark Elegant LoginA near-black gradient with a faint halo, a glass card, and inputs whose border glows only on focus — dark-theme restraint where the glow is reserved for exactly one thing.🔥 Advanced#box-shadow#background#transition
Outlined Display Text
Outlined Display Text-webkit-text-stroke hollows the type into an outline that fills with color on hover — the poster-style headline trick and one of the most broadly useful text treatments around.⚡ Intermediate#color#font-weight#transition
Neon Sign Text
Neon Sign TextFour stacked text-shadows turn type into a neon tube: white core, colored halo, ambient glow, with a @keyframes flicker for that old-tube stutter — the atmosphere king of text effects.🔥 Advanced#text-shadow#animation#color
Seamless Marquee
Seamless MarqueeDuplicate the content end to end and translateX from 0 to -50% on loop — that's a seamless marquee; hover pauses it with one line of animation-play-state. The standard notice-bar pattern where the loop seam is the real trick.🔥 Advanced#animation#overflow#white-space
Terminal 404 Page
Terminal 404 PageA 404 wrapped in a terminal window: traffic-light title bar, black-on-green error lines, a blinking cursor on the last row — the developer-aesthetic Easter egg page, full of monospace typography details.🔥 Advanced#background#font-family#animation
Geometric Minimal 404
Geometric Minimal 404Three pure-CSS shapes — circle, triangle, square — plus an outlined 404, one line of copy and a button. The un-flashy 404 that quietly tests your whitespace and alignment fundamentals.⚡ Intermediate#background#border-radius#position
404 Help & Search
404 Help & SearchDon't just apologize — build a bridge: the 404 line, a centered search box and three popular-page pills turn a lost visitor into a helped one. The search input reuses the focus treatment from our Search Bar example.⚡ Intermediate#flex#border-radius#background
Removable Chips
Removable ChipsFilter/tag chips: text plus an × that turns red-on-white on hover while the chip border deepens — a tiny component hiding an accessibility detail about generous hover target areas.⚡ Intermediate#transition#border-radius#cursor
Gold Silver Bronze Badges
Gold Silver Bronze BadgesTop-three leaderboard badges: metallic gradient borders, medal emoji, and the runner-up card slightly enlarged in the middle — gamified ranking visuals where gradient angle decides the metal feel.⚡ Intermediate#border#background#text-shadow
Live Stream Badge
Live Stream BadgeThe LIVE pill on a stream card: blinking red dot, viewer-count badge, gradient cover. How a status badge comes alive — blink slowly enough to soothe, not so fast it alarms.⚡ Intermediate#animation#border-radius#background
Monthly/Yearly Pricing Toggle
Monthly/Yearly Pricing ToggleA top slider flips monthly/yearly: :checked cross-fades two price sets and pops the 'save 20%' badge — the checkbox hack graduated from menus to business logic, the classic conversion switch on pricing pages.🔥 Advanced#selectors#transition#appearance
Feature Comparison Table
Feature Comparison TableRows for features, columns for plans: scannable ✓/— marks, the recommended plan's whole column highlighted, rows tinting on hover — a textbook on scannable tabular data.🔥 Advanced#border#background#text-align
Hero Pricing Card
Hero Pricing CardOne big card on a gradient stage: an oversized price figure, four feature lines, a prominent button and fine print below — the pricing page for single-plan products, all about hierarchy and button presence.⚡ Intermediate#background#box-shadow#flex
Glass Button
Glass ButtonTranslucent glass buttons on a colorful gradient: rgba white fill, backdrop-filter frosting and a thin bright border, brightening on hover. Glassmorphism moved from cards onto buttons — light, copy-ready.🔥 Advanced#backdrop-filter#background#border
Border Draw Button
Border Draw ButtonHover a transparent button and its border appears to be drawn: two pseudo-element lines growing with scaleX/scaleY on staggered timing, closing the loop. The classic pure-CSS way to fake a drawing motion.🔥 Advanced#border#transition#transform
Pill Button Group
Pill Button GroupA three-segment control: three options joined into one pill, the selected one dark with white text and a shadow, the rest light with hover tint. The go-to list/view switcher, where rounded-corner seams are the detail that matters.⚡ Intermediate#background#box-shadow#flex
Stats Metric Card
Stats Metric CardThree stat cards: a big figure, a label, an up/down arrow in green or red, and a mini trend bar. The opening component of any dashboard, where the size/weight contrast of the number is the whole point.⚡ Intermediate#flex#background#border-radius
Product Card
Product CardAn e-commerce product card: gradient image placeholder, a 'New' corner badge, title, struck-through original price next to the current one, and an add-to-cart button; the whole card lifts on hover. The smallest complete unit of a shop grid.⚡ Intermediate#box-shadow#border-radius#transition
Timeline Card
Timeline CardA vertical timeline: one line threading four node dots, the current one enlarged with a halo, dates and events to the side. Version histories, order tracking and résumés all ride on this pattern.🔥 Advanced#position#border#background
Tab Navigation
Tab NavigationFour tabs where the active one gets a thick underline and dark text, the rest sit gray until hover, with a content panel below. The workhorse of detail and settings pages, animated by the promise of that sliding underline.⚡ Intermediate#border#transition#flex
Mega Menu Nav
Mega Menu NavHover a top-level nav item and a full-width panel unfurls: link groups in columns with icons and descriptions. Pure CSS :hover/:focus-within drives it — the way big sites surface a whole information architecture.🎯 Full Project#position#grid#box-shadow
Sticky Header
Sticky Headerposition: sticky keeps the nav pinned as you scroll, with a shadow fading in and z-index holding it above content. Enough filler text is included so you can scroll and feel it, plus how sticky pairs with scroll-margin.⚡ Intermediate#position#box-shadow#z-index
Dots Wave Loader
Dots Wave LoaderSix dots rise and fall in a wave: one keyframes shared by all, staggered by evenly increasing animation-delay, with opacity and translateY moving together. The primer on staggered timing.⚡ Intermediate#animation#opacity#transform
Orbit Loader
Orbit LoaderA glowing core with a small ball orbiting on a track: rotate the parent, translate the child — the classic split of duties between two transforms, and the minimal prototype for every planetary orbit effect.🔥 Advanced#animation#transform#border-radius
Custom Range Slider
Custom Range SliderStrip input[type=range] with appearance: none and rebuild it: gradient-filled track plus a round thumb that scales on hover. Range inputs vary the most across browsers — this recipe is the rescue.🔥 Advanced#appearance#background#cursor
File Upload Dropzone
File Upload DropzoneA dashed dropzone: folder icon, 'click or drag files here', plus format and size limits; hover recolors the border and tints the fill. The entire visual shell of an upload component in one go.⚡ Intermediate#border#background#transition
Two-Factor Verification
Two-Factor VerificationThe second gate of login: lock icon, a line saying the code went to your phone, four code boxes, a verify button, and a grayed 'resend in 58s'. The standard structure of a security step page.⚡ Intermediate#width#border#letter-spacing
PIN Pad Login
PIN Pad LoginLock-screen style: four dots with two already filled, above a 3×4 keypad (1-9, blank, 0, backspace). The unlock paradigm of mobile and kiosk devices, built on grid layout with rounded key tiles.🔥 Advanced#grid#border-radius#background
Marker Highlight
Marker HighlightKey phrases get a slanted gradient band like a marker stroke, expanding or deepening on hover. The trick for emphasis in body copy — far prettier and more flexible than <mark>.⚡ Intermediate#background#transition#color
Shimmer Text
Shimmer TextFill the text with a wide gradient — metallic or gold — and loop background-position so the sheen sweeps across. Same DNA as gradient text, one animation away from a headline that glows.🔥 Advanced#background-clip#animation#color
Layered 3D Text
Layered 3D TextEight text-shadow layers offset a pixel each build up thickness; on hover the offsets grow for a tilt illusion — 3D lettering without any 3D transform, an old-school move that still holds up.🔥 Advanced#text-shadow#transition#color
Balloon 404 Page
Balloon 404 PagePure-CSS balloons — ellipse, string, highlight — drifting gently on a pale blue sky around a big 404 and a line of copy. A light-hearted 404 for consumer-facing products.⚡ Intermediate#border-radius#animation#background
Space 404 Page
Space 404 PageA deep-space backdrop with scattered stars, a ringed planet, and an outlined 404 floating at center. A cosmos assembled from radial-gradients and border-radius — no images, no apology.🔥 Advanced#background#border-radius#position
Avatar Stack
Avatar StackA stack of overlapping avatars: negative margin-inline-start plus white rings to separate them, the last circle counting '+12'. The 'who's here' marker of collaboration tools, fanning out slightly on hover.⚡ Intermediate#border-radius#border#flex
Progress Steps
Progress StepsA four-step flow bar: completed steps solid with a check, the current one enlarged with a halo, upcoming ones gray, connected by lines. The standard visualizer for checkout, signup and approval flows.🔥 Advanced#flex#border-radius#background
Plan Toggle Cards
Plan Toggle CardsThree horizontal plan cards — monthly, quarterly, yearly — where the chosen one highlights and enlarges, with the matching price area below. A more legible period switcher than a toggle when cycles differ a lot.🔥 Advanced#background#border#transition
Mobile Comparison Pricing
Mobile Comparison PricingA narrow two-column comparison (Basic/Pro): the feature-name column sticks with position: sticky, rows alternate shades for easy horizontal reading. A table that survives small screens — the mobile-first trade-off that matters.🔥 Advanced#position#table-layout#border
Pricing Estimator
Pricing EstimatorA team-size slider beside a live price card: big figure, per-seat rate and a breakdown row. The custom slider plus price hierarchy that lifts SaaS conversion — the math needs JS, this example owns the shell.🔥 Advanced#appearance#background#border-radius
auto-fit vs auto-fill
auto-fit vs auto-fillSide-by-side comparison: with an unfilled last row, auto-fill keeps empty tracks (cards stay left-aligned) while auto-fit collapses them (cards stretch to fill). Drag the window to watch both reflow — zero media queries.⚡ Intermediate#grid#auto-fit#auto-fill#repeat#minmax
Fix Grid Overflow with minmax(0, 1fr)
Fix Grid Overflow with minmax(0, 1fr)Reproduces the classic broken-grid bug: a long URL blows its 1fr track open and crushes the neighbor column. Compare the fixed minmax(0, 1fr) version, with the three fixes (track minmax / item min-width:0 / content overflow-wrap).⚡ Intermediate#grid#minmax#overflow#1fr
No examples at this difficulty in this category

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏