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.
<div class="bg-origin-border p-4 border-4 border-dashed ..." style="background-image: url(...)">
1
</div>
<div class="bg-origin-padding p-4 border-4 border-dashed ..." style="background-image: url(...)">
2
</div>
<div class="bg-origin-content p-4 border-4 border-dashed ..." style="background-image: url(...)">
3
</div>To control the background-origin property at a specific breakpoint, add a {screen}: prefix to any existing background-origin utility. 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>For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.
By default, only responsive variants are generated for background-origin utilities.
You can control which variants are generated for the background-origin utilities by modifying the backgroundOrigin property in the variants section of your tailwind.config.js file.
For example, this config will also generate hover and focus variants:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ backgroundOrigin: ['hover', 'focus'],
}
}
}If you don't plan to use the background-origin utilities in your project, you can disable them entirely by setting the backgroundOrigin property to false in the corePlugins section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ backgroundOrigin: false,
}
}