
Restaurant Menu Card Slide-In
Published
18 copy-paste CSS slide-in animations built as complete real-world scenarios — restaurant menu cards, e-commerce product grids, SaaS pricing tables, insurance quote forms, real estate listings, doctor booking slot pickers, fintech dashboard KPIs with count-up, legal firm testimonials, slider-driven bank loan calculators, hotel search results, online course cards, job listings with salary transparency, CRM contact grids, fitness class schedules, startup landing heroes, newsletter modals, GDPR cookie banners, and 404 error pages. Each demo ships with industry-appropriate palette, typography, and real content — drop it into your vertical without stripping generic styling. Scoped under .sl-NN for no-collision pasting, prefers-reduced-motion guarded, framework-agnostic.
Related16 CSS Fade In Animation Designs22 CSS Transitions20 CSS Scroll Animations

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published
@keyframes slide { from { opacity: 0; transform: translateX(-40px) } to { opacity: 1; transform: translateX(0) } } applied to the element with animation: slide 0.9s cubic-bezier(.22, 1, .36, 1) forwards. Critical detail: animation-fill-mode: forwards locks the final state — without it, the element snaps back to translateX(-40px) and opacity: 0 when the animation ends. The base opacity: 0 in the element's CSS rule prevents flash-of-visible-content before the animation runs. cubic-bezier(.22, 1, .36, 1) is the modern fast-out / slow-arrive ease that gives the slide-in a confident settle. For staggered groups (hero eyebrow + heading + subhead + CTA + proof strip), apply the same animation to each child with incremental animation-delay (0.1s, 0.3s, 0.5s, 0.7s, 0.9s) to create a sequential cascade. Demo #01 ships the canonical 5-element hero pattern; Demo #02 shows the cascading grid variant..sl-NN class names so you can drop multiple onto the same page without conflicts.{ threshold: 0.15 }, on isIntersecting add a .is-visible class that triggers the CSS transition from translateY(40px) + opacity: 0 to their resting state. ~15 lines of vanilla JS, no framework, no library. IntersectionObserver is GPU-friendly and doesn't run on every scroll frame like a manual window.scroll listener would (a major Core Web Vitals win — manual scroll listeners cause INP regressions). Call observer.unobserve(entry.target) after the animation fires to prevent re-triggering on scroll-back. 2. Scroll-driven animations (CSS-only, modern): Chrome 115+, Edge 115+, Opera 101+, partial Safari 26+ and Firefox 134+ support animation-timeline: view(block) which lets you drive a slide-in entirely from CSS based on the element's position in the viewport — zero JavaScript. Demo #06's CSS includes a commented-out scroll-driven-animations version next to the IntersectionObserver implementation; uncomment if your target browsers support it. Don't use libraries like AOS (Animate On Scroll, ~15KB) or wow.js (~6KB) for this — both add bundle weight and external dependencies for what's now a 15-line vanilla pattern or zero-line CSS feature.opacity: 0 AND transform: translateX(-40px) in the element's base CSS, the browser paints the element in its natural position before the animation runs. Then the animation snaps it to the offset position, then animates back — a visible jump. Fix: ALWAYS set the initial state (both opacity AND transform) in the base rule. 2. Missing animation-fill-mode: forwards: without it, the animation runs and then the element snaps back to its INITIAL state — if the base rule has opacity: 0, the element disappears after animating. Fix: BOTH set the initial state in the base rule AND set animation-fill-mode: forwards. The base state prevents pre-animation flash; forwards locks the final state. 3. CSS not in <head>: the browser paints HTML with default styles before the stylesheet loads. Fix: load your animation CSS in <head> as a critical <link rel='stylesheet'>, NOT lazy-loaded or async. For inline-on-render frameworks (Astro, Next.js with server components), the CSS is bundled with the HTML so this isn't usually an issue. 4. Browser back-button restoration: when a user navigates away and back via the browser back button, some browsers replay the page from a cached state where animations have already run. Use pageshow event handlers to re-trigger animations on bfcache restore, OR use transition instead of animation for state-driven slides.prefers-reduced-motion: reduce. Slide-in specifically is riskier than fade-in for vestibular-sensitive users because horizontal or vertical translation can trigger motion sickness. The recipe: wrap every element's initial state and animation declaration in @media (prefers-reduced-motion: reduce) { .element { animation: none; opacity: 1; transform: none; } } so users with reduced-motion see the final state instantly. Every demo in this collection ships the reduced-motion guard automatically. Additional a11y concerns: (1) Don't slide-in content that's required for understanding — long slide durations on body text frustrate screen-reader users who hear an empty page. (2) Don't slide-in error messages, validation, or interactive controls — these need instant visibility. (3) Slide-in content should still be in the DOM at opacity: 0 (not display: none or visibility: hidden) so screen readers can pre-announce it. (4) Reserve final layout space to prevent CLS. Focus management: modals (Demo #08) and drawers (Demo #04) require focus trap and role='dialog' — the animations are decorative but the accessibility contract is mandatory.animate__animated animate__slideInLeft classes. Wide variety of presets but you ship 70KB even if you only use 1 slide-in. Framer Motion (~80KB gzipped): React-first animation library with declarative initial={{ x: -40, opacity: 0 }} and animate={{ x: 0, opacity: 1 }} props. Powerful for scroll-driven and gesture animations but adds significant bundle weight. GSAP (~50KB core, +30KB ScrollTrigger): the industry-standard JS animation library, beats CSS for complex timelines and morphing but overkill for simple slide-ins. anime.js (~17KB minified): leaner GSAP alternative. This collection vs all of the above: the same slide-in effects in 4-30 lines of CSS per demo that ship inline with your HTML — zero bundle cost, zero npm dependency, zero CVE surface, faster First Contentful Paint and Largest Contentful Paint, no library hydration delay. For 95% of slide-in use cases (entrances, scroll reveals, staggered cards, toasts, drawers), the CSS approach wins on every Core Web Vitals dimension. Reserve GSAP / Framer Motion for complex scrubbed timelines and morph transitions; reserve animate.css for prototyping speed. Production marketing pages should ship the CSS recipes from this collection.animate-slide-in only via plugins (tailwindcss-animate which shadcn uses) — by default Tailwind has animate-bounce, animate-pulse, animate-spin, and animate-ping but NOT baseline slide-ins. To add: register a custom slideInLeft keyframe + utility in tailwind.config.js (or extend via theme.extend.keyframes + theme.extend.animation), OR use arbitrary-value syntax animate-[slideIn_.9s_ease-out_forwards]. Our CSS to Tailwind converter handles the conversion automatically. shadcn/ui: ships tailwindcss-animate plugin out of the box (enables animate-in slide-in-from-left-4 slide-in-from-bottom-8 etc) — used by Radix UI components. Material UI / MUI: ships the <Slide direction="up" in={true} timeout={500}> component (uses MUI's transitions package, ~10KB), or via the sx prop's transition shortcut. Chakra UI: ships <SlideFade in={open}> as a first-class component. Framer Motion: pair initial={{ x: -40, opacity: 0 }} + animate={{ x: 0, opacity: 1 }} + transition={{ duration: 0.9 }}. For static marketing pages, the CSS approach in this collection ships zero JavaScript for 15 of the 18 demos — for slide-in-driven hero pages and scroll-reveal sites, this is the lowest-overhead approach.transform: translateX() shifts the element's PAINTED position without triggering layout — transform-driven slides don't cause CLS (good). But left, top, margin-left, width, height DO affect layout — avoid these for slide-in animations. Use opacity + transform only. 2. Image-driven slides without reserved dimensions: if your sliding element contains an <img> that loads asynchronously, the image's intrinsic dimensions can shift layout AFTER the slide starts. Fix: set width + height attributes on the img OR use aspect-ratio on the container. 3. Font-swap during slide: web fonts loading mid-slide can re-flow the text. Fix: font-display: optional or pair font-display: swap with size-adjust in @font-face. 4. Late-loading content sliding in below existing content: scroll-triggered slides on long pages can shift the viewport if the user scrolls past the element while it animates. Demo #06 uses IntersectionObserver with { threshold: 0.15 } to fire the animation early enough that it completes before the user scrolls into the affected zone. Tools to audit: Chrome DevTools Performance Insights, Lighthouse, Core Web Vitals report in Google Search Console, WebPageTest.appearance: none + ::-webkit-slider-thumb (Chrome/Safari) + ::-moz-range-thumb (Firefox) with a linear-gradient background that renders the fill percentage via a CSS custom property: background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--fill), var(--track) var(--fill), var(--track) 100%). JavaScript updates --fill on input event so the fill tracks the thumb in real time. Payment calculation: use the standard amortization formula M = P[r(1+r)^n] / [(1+r)^n - 1] where P is principal, r is monthly rate (APR/12/100), n is total payments (years × 12). Fire recalculation on every slider input event with no CSS transition on the number (transitions feel laggy for real-time updates). Compliance requirements (US-only): federal Truth in Lending Act (TILA) requires displaying APR + "For estimation only, not a commitment to lend" disclaimer alongside every calculated payment. State usury laws cap max rates (36% APR illegal in many states) — never let sliders exceed your state's legal cap. For adjustable-rate mortgages (ARMs), display both the introductory teaser rate AND the fully-indexed rate — CFPB has scrutinized teaser-only advertising since 2016. Layout convention: single centered card, mortgage-industry deep-blue palette (Chase blue #005EB8, Wells Fargo red #D71E28, Ally purple #7B2CBF). Include an amortization breakdown chip row below the payment (Total interest / Total paid / APR) so users can compare scenarios. Demo #09 ships all of the above with count-up on initial reveal via requestAnimationFrame + cubic-out easing over 1.2s.autocomplete attribute (ZIP = postal-code, first name = given-name, phone = tel, birthday = bday) — missing autocomplete tanks conversion 20-40% on mobile because users can't autofill. Trust signals go below the CTA: A.M. Best rating badge, BBB accreditation, 5-star review count, insurance-network chip row. These are conversion-critical, not decorative — insurance is a trust-first purchase. Compliance requirements: state insurance departments regulate advertising language — never claim "guaranteed savings" (illegal in most states). Use conditional language: "typically save," "average customer saves," "drivers who switch report saving X%." NAIC (National Association of Insurance Commissioners) guidelines require the disclaimer "For estimation purposes only. Actual rates vary based on individual circumstances" for any calculated premium. Never auto-refresh the quote number to look dynamic — reads as deceptive. Palette convention: deep navy (#0a2540) for institutional trust, green save-callout (#22c55e) for positive-outcome signals (research shows green = savings; red = urgency/danger). Layout tip: for auto insurance specifically, add a VIN-lookup field that auto-populates make/model/year — reduces form abandonment 30%. For life insurance, add age + smoker status as additional cascaded fields with clear "Estimate only, medical exam required" disclaimer. Demo #04 ships form autocomplete, trust signals, and NAIC-compliant estimated-premium language.grid-template-columns: repeat(3, 1fr)), middle tier scaled to 1.05 with a colored glow shadow and "Most popular" badge. Cascading animation via @keyframes with staggered :nth-child delays (0.15s, 0.3s, 0.45s). The critical trick: the featured middle tier needs a SEPARATE @keyframes that preserves its scale(1.05) during the slide-in — using the same keyframe as the other tiers snaps it back to scale(1) at animation end. Solution: @keyframes sl-03-featured { from { opacity: 0; transform: translateY(40px) scale(1.05); } to { opacity: 1; transform: translateY(0) scale(1.05); } }. Conversion research (Stripe + ProfitWell studies 2022-2024): visually anchoring the middle tier lifts conversion 12-24% because users default to the option that looks recommended. Never animate the price number during entry — users need immediate cost visibility. Feature bullets can cascade, price stays static. Feature list convention: 3-5 bullets per tier, checkmark icons via SVG background-image (not emoji — inconsistent across platforms). Bullets should be OUTCOMES not features ("Unlimited projects" not "Unlimited API endpoints"). CTA hierarchy: middle tier gets a filled gradient primary button; other two tiers get ghost/outline buttons. This visual weight reinforces the "pick middle" nudge. For enterprise tier, replace price with "Contact sales" — never show a hypothetical enterprise price, it looks fabricated. Palette convention: deep violet gradient (#8b5cf6 → #6366f1) is the Stripe/Linear/Vercel canonical — reads as SaaS trust. Add a colored glow shadow (box-shadow: 0 24px 48px -16px rgba(139,92,246,.4)) matched to the featured-tier accent to anchor the eye. Mobile responsive: below 720px stack vertically, and the featured tier animation must switch back to the regular sl-03-tier keyframe (without scale) — otherwise the scaled middle tier looks off-center in the stacked layout. Demo #03 ships all of the above.prefers-reduced-motion: reduce (animations fall back to instantly-visible final state), uses semantic HTML, and is designed to work with screen readers (elements remain in the DOM at opacity: 0, not display: none). Modals and drawers ship with role='dialog' and aria-modal='true'. Verify your specific use case with axe DevTools, Lighthouse, WAVE, or the WebAIM tools before shipping to EU EAA / US Section 508 / Canada ACA / UK Equality Act audits — the demos are AA-compliant by default but layout context matters.20 hand-coded CSS animated buttons — neon glow, ripple, 3D press, liquid fill, jelly bounce, shine sweep, animated border, moving gradient CTA, text flip, submit success state, add-to-cart progress, download icon, hamburger-to-close, toggle switch, loading spinner inside button, next/prev arrow nav, and ghost button background reveal. Half pure CSS, half lightweight JS for production interactions.
11 pure CSS animation-timeline demos built on the W3C scroll() and view() spec — reading progress bar, view-timeline fade & reveal, shrinking sticky header, stacking cards, horizontal scroll section, parallax hero, container shadow indicators, reverse-scroll columns, text scrim reveal, cover card to sticky header, and image zoom / clip-path wipe. Zero JS, off the main thread, Core Web Vitals safe. Copy-paste ready.
25 hand-coded CSS background animations for SaaS hero sections, developer tool documentation, agency portfolios, gaming and Web3 landing pages, seasonal e-commerce campaigns, and dark-mode dashboards. Covers full-screen gradient shifts, animated mesh gradients, aurora borealis glow, cursor spotlight follow, interactive water ripples, dot grid and diagonal stripe patterns, SVG grain and noise texture overlays, topographic contour lines, layered SVG waves, plasma and lava lamp fluids, bokeh light blur, particle constellation networks, matrix digital rain, synthwave 3D perspective grids, starfield warp speed, CRT scanline overlays, fog and mist drift, morphing organic blobs, floating glassmorphism orbs, halftone dot patterns, starry night skies, floating geometric shapes, rising bubbles, and falling snow. 20 are pure CSS with zero JavaScript; the 5 that need it use vanilla canvas or pointer tracking with no dependencies. Every background animates compositor-only properties so it never blocks the main thread, is scoped under a .bga-NN prefix for no-collision pasting, guards prefers-reduced-motion, and ports unchanged to React, Vue, Svelte, Astro, Next.js and Tailwind.