Backgrounds
Utilities for controlling how an element's background is positioned relative to borders, padding, and content.
Use bg-origin-border
, bg-origin-padding
, and bg-origin-content
to control where an element’s background is rendered.
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">
<!-- ... -->
</div>
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">
<!-- ... -->
</div>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.