CSS Portal

CSS view-timeline-inset Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The view-timeline-inset property controls an inset rectangle that alters the area used as the "viewport" for view-based timelines. Rather than relying strictly on the element’s outer used box as the region that determines timeline progress and intersection-like checks, this property lets authors shrink or expand that region relative to the element. The resulting adjusted rectangle is what the browser uses when calculating how far through a view timeline an element is (and therefore how animations attached to that timeline progress), so changing the inset effectively changes when and how strongly view-driven animations run.

Because it changes the geometry that drives timeline progress, view-timeline-inset is a precision tool for timing and choreography. You can use it to cause an animation to begin earlier or later relative to the element’s visual appearance in the viewport, to delay a visibility-triggered effect until more of the element is inside the area of interest, or to create "buffer" regions that require deeper intersection before progress advances. It is commonly used together with a view timeline declaration such as view-timeline to refine exactly how that timeline interprets the element’s position and coverage.

In layout and interaction scenarios, the inset moves with the element - the adjusted rectangle is applied in the same coordinate context used by the timeline, so transforms, scrolling, and layout changes that affect the element will also affect the timeline region. When combined with timeline-driven animations (for example those tied through animation-timeline), the inset can subtly change easing and sequence because it affects the mapping from element position to timeline progress. Because it affects when animations become active, consider accessibility and performance: tuning the inset can reduce unnecessary off-screen animation work, but it can also make effects harder to discover if the trigger region becomes too small or too disconnected from the visible target.

Definition

Initial value
auto
Applies to
all elements
Inherited
no
Computed value
a list consisting of two-value pairs representing the start and end insets each as either the keyword auto or a computed value
Animatable
by computed value type
JavaScript syntax
object.style.viewTimelineInset

Syntax

view-timeline-inset: <inset-values>;

Values

  • <inset-values> can be specified in lengths (px, em, etc.) or percentages (%) and can be one or two values. When one value is specified, it applies to both start and end. When two values are specified, the first is the start inset, and the second is the end inset.

Example

<div class="scroll-container">
<div class="spacer">Scroll down to see the box animate</div>

<div class="animating-box"></div>

<div class="spacer">Keep scrolling...</div>
</div>
/* 1. Define the animation */
@keyframes reveal {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 2. Configure the scroll-driven animation */
.animating-box {
  width: 200px;
  height: 200px;
  background: #3498db;
  margin: 100px auto;
  border-radius: 12px;

  /* Identify the view timeline */
  view-timeline-name: --reveal-timeline;
  view-timeline-axis: block;

  /* INSET: Adjusts the start/end margins of the timeline */
  /* This waits for the element to be 20% into the viewport before starting */
  view-timeline-inset: 20%;

  /* Link the animation to the timeline */
  animation: reveal linear both;
  animation-timeline: --reveal-timeline;
}

/* Styling for the demo environment */
.scroll-container {
  font-family: sans-serif;
}

.spacer {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f4f4;
  font-size: 1.5rem;
  color: #666;
}

Browser Support

The following information will show you the current browser support for the CSS view-timeline-inset property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported in some modern browsers, but not all.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!