Background size
Utilities for controlling the background size of an element's background image
Class reference
Auto
Use .bg-auto
to display the background image at its default size.
Cover
Use .bg-cover
to scale the background image until it fills the background layer.
Contain
Use .bg-contain
to scale the background image to the outer edges without cropping or stretching.
Responsive
To control the size of an element’s background image at a specific breakpoint, add a {screen}:
prefix to any existing background size utility. For example, adding the class md:bg-contain
to an element would apply the bg-contain
utility at medium screen sizes and above.
<div class="bg-auto md:bg-contain ..."></div>
For more information about Elements’ responsive design features, check out the Responsive Design documentation.
On this Page
v1.13.5