VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstrap-5-background/

⇱ Bootstrap 5 Background - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Background

Last Updated : 25 Jul, 2024

Bootstrap 5 Background is used with the help of the keyword bg. It offers various colors like primary, success, info, warning, danger, secondary, dark, and light.

  • Background Color: The background color of the elements is set to contextual class like .bg-primary, .bg-success, and so on.
  • Background gradient: A linear gradient is applied to the backgrounds by adding color value and the .bg-gradient class to it.
  • Sass: This involves the Sass map and spacing utilities that are declared in Utility API.

The below examples illustrate the Bootstrap 5 Background:

Example 1: The following code demonstrates different background Color classes of Bootstrap 5.

Output:

Example 2: The following code demonstrates different background Gradient classes.

Output:

Reference: https://getbootstrap.com/docs/5.0/utilities/background/

Comment

Explore