Tailwind CSS Background Repeat
The bg-{repeat} utility class in Tailwind CSS allows you to control the repetition behavior of background images applied to elements. With Tailwind background repeat class, you can easily adjust how background images are repeated to achieve the desired visual effect.
Tailwind Background Repeat
The bg-{repeat}
utility class in Tailwind CSS allows you to control the repetition behavior of background images applied to elements. With Tailwind background repeat class, you can easily adjust how background images are repeated to achieve the desired visual effect.
Applying Tailwind Background Repeat
To apply a specific tailwind background repeat behavior to an element, you can use the bg-{repeat}
utility class, where {repeat}
represents the desired background repeat behavior. Here are some common values you can use:
bg-repeat
: The background image is repeated both horizontally and vertically.bg-no-repeat
: The background image is not repeated, appearing only once.bg-repeat-x
: The background image is repeated horizontally but not vertically.bg-repeat-y
: The background image is repeated vertically but not horizontally.
<div class="bg-repeat"> This element has a background image that is repeated both horizontally and vertically.</div>
Preview
Responsive Tailwind Background Repeat
Tailwind CSS allows you to apply background repeat classes responsively at different breakpoints. To use responsive tailwind background repeat classes, you can append the breakpoint prefix to the utility class. For example, md:bg-no-repeat
sets the background to not repeat starting from the medium breakpoint and above.
<div class="bg-no-repeat md:bg-repeat"> This element has a background image that doesn't repeat by default, but starting from the medium breakpoint and above, it repeats both horizontally and vertically.</div>
In the above example, the tailwind background repeat behavior of the <div>
element is set to not repeat by default (bg-no-repeat)
, but starting from the medium breakpoint and above, it changes to repeat both horizontally and vertically (md:bg-repeat)
.
Tailwind Background Repeat Class Table
Class | Properties |
---|---|
bg-repeat | background-repeat: repeat; |
bg-no-repeat | background-repeat: no-repeat; |
bg-repeat-x | background-repeat: repeat-x; |
bg-repeat-y | background-repeat: repeat-y; |
bg-repeat-round | background-repeat: round; |
bg-repeat-space | background-repeat: space; |
Windframe Tailwind blocks
Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs