Background Position

    Use the utilities to control the position of an element’s background image.

    To control the position of an element’s background image at a specific breakpoint, add a {screen}: prefix to any existing background position utility. For example, adding the class md:bg-top to an element would apply the bg-top utility at medium screen sizes and above.

    For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.

    Background Position - 图2

    all

    sm

    md

    Background Position - 图5

    lg

    By default Tailwind provides nine utilities. You change, add, or remove these by editing the theme.backgroundPosition section of your Tailwind config.

    By default, only responsive variants are generated for background position utilities.

    You can control which variants are generated for the background position utilities by modifying the backgroundPosition property in the variants section of your file.

    For example, this config will also generate hover and focus variants:

    If you don’t plan to use the background position utilities in your project, you can disable them entirely by setting the backgroundPosition property to false in the corePlugins section of your config file:


      Background Repeat →