Tailwind CSS - Background Position



Tailwind CSS Background Position is a utility that specifies from where the background image will be positioned within an element.

Tailwind CSS Background Position Classes

The following is the list of Tailwind CSS Background Position Classes that are used to set the position of a background.

Class CSS Properties
bg-bottom background-position: bottom;
bg-center background-position: center;
bg-left background-position: left;
bg-left-bottom background-position: left bottom;
bg-left-top background-position: left top;
bg-right background-position: right;
bg-right-bottom background-position: right bottom;
bg-right-top background-position: right top;
bg-top background-position: top;

Functionality of Tailwind CSS Background Position Classes

  • bg-bottom: This class is used to position the background image at the bottom.
  • bg-center: This class is used to position the background image at the center.
  • bg-left: This class is used to position the background image at the left.
  • bg-left-bottom: This class is used to position the background image at the left-bottom.
  • bg-left-top: This class is used to position the background image at the left top.
  • bg-right: This class is used to position the background image at the right.
  • bg-right-bottom: This class is used to position the background image at the right-bottom.
  • bg-right-top: This class is used to position the background image at the right-top.
  • bg-top: This class is used to position the background image at the top.

Tailwind CSS Background Position Examples

The following example will illustrate the different utility of Background Position Classes.

Bottom Alignment Of Background Image

The below example illustrates the use of bg-bottom class.

Example




    



    

Tailwind CSS Bg Bottom Class

Center Alignment Of Background Image

The below example illustrates the use of bg-center class.

Example




    


    

Tailwind CSS Bg Center Class

Left Alignment Of Background Image

The below example illustrates the use of bg-left class.

Example




    



    

Tailwind CSS Bg Left Class

Left Bottom Alignment Of Background Image

The below example illustrates the use of bg-left-bottom class.

Example




    



    

Tailwind CSS Bg Left Bottom Class

Left Top Alignment Of Background Image

The below example illustrates the use of bg-left-top class.

Example




    



    

Tailwind CSS Bg Left top Class

Right Alignment Of Background Image

The below example illustrates the use of bg-right class.

Example




    



    

Tailwind CSS Bg Right Class

Right Bottom Alignment Of Background Image

The below example illustrates the use of bg-right-bottom class.

Example




    



    

Tailwind CSS Bg Right Bottom Class

Right Top Alignment Of Background Image

The below example illustrates the use of bg-right-top class.

Example




    



    

Tailwind CSS Bg Right Top Class

Top Alignment Of Background Image

The below example illustrates the use of bg-top class.

Example




    



    

Tailwind CSS Bg Top Class

Advertisements