bootstrap background image responsive code example

Example 1: make a background image responsive css

html {
   min-height: 100%;
   background-image: url(image.jpg);
   background-size: cover;
   background-repeat: no-repeat;
   background-position: center center;
}

Example 2: add background image in bootstrap 5

<div class="has-bg-img bg-purple bg-blend-screen">
  <h4>Background blend mode: Multiply</h4>
  <img class="bg-img" src="...">
</div>

Example 3: Scaling Images and Videos css

.container {
  width: 50%;
  height: 200px;
  overflow: hidden;
}

.container img {
  max-width: 100%;
  height: auto;
  display: block;
}

Tags:

Html Example