Last updated: 20 May 2024

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.
html
<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.

html
<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

ClassProperties
bg-repeatbackground-repeat: repeat;
bg-no-repeatbackground-repeat: no-repeat;
bg-repeat-xbackground-repeat: repeat-x;
bg-repeat-ybackground-repeat: repeat-y;
bg-repeat-roundbackground-repeat: round;
bg-repeat-spacebackground-repeat: space;

Windframe Tailwind blocks

Timeline

Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs

Start building stunning tailwind UIs! 

Build from scratch or select prebuilt tailwind templates