Slide-in animations move elements into view from outside their natural position, communicating directionality and spatial context to the user in a way that a simple fade-in cannot.
Loading Animation Builder…
Slide from left, right, top, or bottom
Control entry distance from subtle to full-panel
Combine with opacity for a polished entrance
Generates overflow-safe CSS for the parent container
Drop the Animation Builder into any page — blog post, product docs, intranet, school portal — with a single line of HTML. Your visitors get the full tool, processed entirely in their browser. No backend, no uploads, no signup.
Embed code
<iframe
src="https://www.fixtools.io/css-tool/animation-builder?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="Animation Builder by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
A slide-in animation works by starting the element at an offset position using CSS transform: translateX() or translateY(), then animating that offset back to 0 over the animation duration. The translateX value shifts the element horizontally: a positive value moves the element to the right of its natural position so it slides in from the right, while a negative value moves it left so it slides in from the left. The translateY value shifts it vertically: a positive value places the element below its final position so it slides up into view, and a negative value places it above so it slides down. Because translate values are relative to the element itself rather than the viewport, the starting position scales with the element size unless you use a fixed pixel value. A starting value of translateX(100%) slides the element in from entirely off its own right edge regardless of element width, while translateX(30px) slides it in from just 30 pixels offset and produces the same visual distance regardless of element size.
Choosing direction and distance communicates spatial meaning to the user that goes beyond the surface aesthetic of the motion. Sliding from the left is the standard direction for navigation drawers in most design systems, matching the convention that primary navigation lives to the left of the main content in left-to-right writing systems. Sliding from the bottom is the standard for mobile modal sheets, action menus, and contextual confirmations, matching the iOS and Android native pattern of secondary content rising from the bottom of the screen. Sliding from the top suits dropdown menus, notification panels, and announcement banners. The distance determines how dramatic the entrance feels: 20 to 30 pixels creates a subtle entrance suitable for cards and tooltips that should feel like they nudged into view, while 100 percent creates a full-panel entrance suitable for navigation drawers and full-screen modals that should feel like they came from off-screen entirely.
Containing the animation is a practical concern that code examples often omit and that causes the most common slide-in bug shipped to production. During the translate phase, the animating element exists at a position outside its natural layout position. If the parent container does not have overflow: hidden, the browser renders a horizontal or vertical scrollbar during the slide-in to accommodate the temporarily out-of-bounds element, which is almost always undesirable and looks like an unintended layout glitch. Adding overflow: hidden to the parent element containing the slide-in target prevents the scrollbar entirely. For navigation drawers that slide over the page rather than within a container, apply overflow: hidden to the document body during the animation and remove it after the transition completes using a JavaScript class toggle, so normal page scrolling resumes once the drawer is settled.
Combining a slide-in with a fade-in is one of the highest-leverage upgrades to the basic slide pattern, and it eliminates the visual oddity of the element being visible at its off-screen starting position before the animation begins. Without a fade, the user can briefly see the element popping into existence at its offset position the moment the animation class is added, which is most obvious on slower connections where the CSS may apply a frame or two before the keyframes start playing. Adding opacity: 0 at the 0 percent keyframe and opacity: 1 at 100 percent solves this completely: the element fades up from invisible to fully visible while simultaneously sliding into position, so the off-screen starting point is never seen by the user. Both transform and opacity animate on the compositor thread, so the combined effect has no measurable performance cost compared to the slide alone, and the polished result is the convention in most modern UI frameworks for a reason.
Choose an entry direction and distance. Add a fade-in by enabling the opacity option. Set duration and easing, then preview the slide. Copy the code and add overflow: hidden to the parent to prevent a scrollbar during the translate phase.
Step-by-step guide to css slide in animation:
Choose slide direction
Select the entry direction from the four options: from left, right, top, or bottom. Match the direction to the established UI pattern for the element type. Use from-left for navigation drawers, from-bottom for mobile sheets and toasts on phones, from-top for dropdowns and notification banners, and from-right for contextual detail panels that supplement the main content. Inconsistent slide directions across components break the user's spatial model of the interface.
Set entry distance
Enter the starting translate distance using either a pixel value or a percentage. Use 20 to 30 pixels for subtle card entrances that feel like the element nudged into view from just outside its current position. Use 100 percent for full-panel slides where the element should start completely off its own edge regardless of width. Choose a fixed pixel value rather than a percentage when you need predictable behavior independent of element size, such as inline alerts that may be any width.
Enable opacity fade (optional)
Turn on the opacity option to combine the slide with a fade-in, which is the recommended pattern for almost every slide-in use case. Starting opacity at 0 and ending at 1 prevents the element from being briefly visible at its off-screen starting position, which can flash for a frame on slower connections before the animation begins. The combined slide-and-fade adds no performance cost because both transform and opacity run on the compositor thread, and it produces a more polished result.
Add overflow: hidden to the parent
After pasting the generated code into your stylesheet, add overflow: hidden to the parent element containing the slide-in target to prevent a scrollbar appearing during the translate phase. For full-viewport drawers, apply overflow: hidden to the body element during the animation and remove it after the transition completes via a JavaScript class toggle so normal scrolling resumes once the drawer is settled. This single addition prevents the most common slide-in bug shipped to production.
Common situations where this approach makes a real difference:
Mobile navigation drawer
A mobile app developer creates a left-side navigation drawer using a translateX(-100%) to translateX(0) animation with 300ms ease-out easing applied via a CSS transition rather than a keyframe animation so the drawer can reverse cleanly when closed. The drawer is positioned fixed and slides over the page content when a hamburger button toggles the open class. Overflow: hidden on the body prevents a horizontal scrollbar during the slide, and is removed once the drawer is closed so normal page scrolling resumes. A semi-transparent backdrop fades in simultaneously to dim the content behind the drawer and to act as a click target for closing.
Bottom action sheet on mobile
A mobile web developer builds an action sheet component using translateY(100%) to translateY(0) with ease-out easing at 250 milliseconds, matching the iOS and Android native pattern of contextual sheets rising from the bottom of the screen. The sheet contains a list of actions (Share, Edit, Delete) presented over a dimmed backdrop that fades in simultaneously with the sheet slide. The distance is 100 percent rather than a fixed pixel value to ensure the sheet starts below the viewport regardless of how much content it contains, which avoids the bug where a tall sheet remains partially visible at its starting position before the animation begins.
Card entrance in a content feed
A social feed component applies a translateX(-20px) to translateX(0) with opacity 0 to 1 entrance to each new card appended to the feed as the user scrolls or as new posts arrive. The 20-pixel offset is subtle enough to create a sense of motion without making the card appear to come from off-screen entirely, and the combined fade prevents the card from being briefly visible at its offset starting position. Duration is set to 200 milliseconds for a responsive feel that does not delay the user's scrolling, and the same animation class is applied to every new card so the entrance behavior stays consistent regardless of the card content type.
Inline notification slide-in
A form validation system slides error messages in from the right side using translateX(10px) to translateX(0) combined with opacity 0 to 1 at 180 milliseconds ease-out, applied when the validation handler adds an error class to the message container. The rightward origin gives the message a subtle sense of arriving from outside the current focus area without the abrupt feel of a simple opacity flash. The short duration keeps the UI feeling snappy and ensures the user does not feel the form is unresponsive during validation. The same pattern is reused for success and warning messages with only the color and icon changing.
Use this when building navigation drawers, side panels, modals that enter from below, or any element that should enter from a specific direction rather than appearing in place.
Get better results with these expert suggestions:
Use translateX percentages for responsive elements
Using translateX(100%) rather than a fixed pixel value makes the slide-in distance scale automatically with the element size, which is the correct behavior for navigation drawers and full-panel slides where the element must start completely off its own edge regardless of viewport size or content height. Use fixed pixel values like translateX(30px) only when you want a consistent subtle offset regardless of element width, such as for inline card entrances where the absolute distance matters more than the proportional offset, or for short alerts where a 30px nudge always looks right.
Add overflow: hidden to the right parent, not the body
Adding overflow: hidden to the document body prevents all page scrolling, which can create a jarring experience if the user was mid-scroll when the animation started or if the slide-in element is shorter than the viewport. Instead, identify the nearest ancestor element that fully contains the slide-in target's animation path and apply overflow: hidden there. For an element sliding within a sidebar, that ancestor is the sidebar container, not the body. Reserve body overflow: hidden for full-page drawer overlays where the drawer covers the entire viewport.
Match slide direction to the spatial model of your UI
Navigation that logically lives to the left of the content should slide in from the left. Contextual detail panels that supplement the main content should slide from the right. Content that stacks below the current view (action sheets, toasts, contextual menus) should rise from the bottom. Notification banners and announcement bars should drop from the top. Inconsistent slide directions break the user's mental model of where UI elements live spatially and force them to relearn the spatial geometry every time they encounter a new component.
Test slide-in animations at both 300ms and 600ms before deciding
The difference between 300ms and 600ms for a full-panel slide is perceptible and meaningful, and the right choice depends entirely on the role of the element. 300 milliseconds feels snappy and functional, appropriate for utility panels users open many times in a session like settings drawers and filter panels. 600 milliseconds feels premium and deliberate, appropriate for branded hero moments like onboarding overlays and empty-state CTAs. Test both durations side by side in the live preview before committing, and consider that the right answer often falls between the two values rather than at either extreme.
More use-case guides for the same tool:
Open the full Animation Builder — free, no account needed, works on any device.
Open Animation Builder →Free · No account needed · Works on any device