Краткая справка

bg-origin-borderbackground-origin: border-box;
bg-origin-paddingbackground-origin: padding-box;
bg-origin-contentbackground-origin: content-box;

Основы использования

Установка источника фона

Используйте bg-origin-border, bg-origin-padding и bg-origin-content для управления отображением фона элемента.




<div class="bg-origin-border p-4 border-4 border-dashed ..." style="background-image: url(...)"></div>
<div class="bg-origin-padding p-4 border-4 border-dashed ..." style="background-image: url(...)"></div>
<div class="bg-origin-content p-4 border-4 border-dashed ..." style="background-image: url(...)"></div>

Применяя условно

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:bg-origin-padding to only apply the bg-origin-padding utility on hover.

<div class="bg-origin-border hover:bg-origin-padding">
  <!-- ... -->

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States 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-origin-padding to apply the bg-origin-padding utility at only medium screen sizes and above.

<div class="bg-origin-border md:bg-origin-padding">
  <!-- ... -->

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.