Example 2: Background Image - Correct Implementation

Nature Scene

This div uses a background image with bg-cover and bg-center .

It also has h-96 to ensure the background is visible and has space.

bg-cover makes the image cover the entire area, potentially cropping.

bg-center positions the image from its center.

City at Night

Another example with bg-cover , bg-center , and explicit bg-no-repeat .

bg-no-repeat is good practice, though often implied by bg-cover 's behavior of scaling to fill.

Key Takeaways for Background Images: