Wat is CSS progress() Functiecalculator?
The CSS progress() function is a mathematical mapping function (Chrome 138+) that converts an input value from one numeric range into a 0-1 progress value. For example, progress(scroll-position from 0 to 500) returns 0 when the scroll position is 0, 1 when it reaches 500, and 0.5 at 250. This progress value can drive any numeric CSS property, eliminating complex calc() chains for scroll-linked effects, viewport-relative sizing, and custom property interpolation.
Snel antwoord
Use CSS progress(input from min to max) to map any numeric value to a 0-1 progress range. Drive opacity, scale, transform, color-mix percentages, or any number-accepting CSS property based on scroll position, viewport dimensions, or custom properties. Chrome 138+. Wrap in clamp(0, ..., 1) to bound the output.
Beperkingen
- progress() requires Chrome 138+. Firefox, Safari, and older Chrome versions do not support it. Use scroll-driven animation keyframes or JavaScript-based scroll listeners as fallbacks for cross-browser support.
- The function only works with numeric CSS properties. It cannot directly drive color stops, gradient angles, or shape functions. For color transitions, combine progress() with color-mix() using the progress value as the mixing percentage.
- scroll-position in progress() measures the document scroll position by default, not an element's scroll container. Use self-scroll-position for a specific scroll container, but ensure the container is scrollable and has a defined scroll range.
Zo gebruik je deze tool
- Enter the input source and its range — choose from scroll-position, viewport width/height, viewport inline/block size, or a custom CSS property with its minimum and maximum values.
- Set the target CSS property you want to drive and its value at progress 0 and progress 1 — for example opacity 0 to 1, or scale 0.5 to 1.5.
- Optionally enable clamp() wrapping to keep the result bounded within the output range even when the input exceeds the defined range.
- Copy the generated CSS and add it to your stylesheet. The output includes both the progress() rule and the full property declaration.
Waarvoor je het kunt gebruiken
- Drive a sticky header's opacity from fully transparent to opaque as the user scrolls from 0 to 200 pixels down the page.
- Scale a hero image from 1 to 1.2 as the viewport width grows from 320px to 1920px, creating a subtle zoom effect on wider screens.
- Control a color-mix() mixing percentage to transition from one color to another based on how far through a section the user has scrolled.