Background Attachment

    Utilities for controlling how a background image behaves when scrolling.

    Use to fix the background image relative to the viewport.

    Background Attachment - 图2

    Use to scroll the background image with the viewport, but not with the container.


    For a complete list of all available state modifiers, check out the documentation.

    You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:bg-fixed to apply the utility at only medium screen sizes and above.

    To learn more, check out the documentation on , Dark Mode and .