skip to Main Content

I’m doing a Django project and I’m using the blog example from Bootstrap 5

I’m trying to embed an image into the first div. So it goes from this:

Before

To this:

It’s photoshopped.
enter image description here

How can I do that?

This is the div I’m trying to edit:

    <div class="p-4 p-md-5 mb-4 rounded text-bg-dark">
            <div class="col-md-6 px-0">
                <h1 class="display-4 text-white fst-italic">We are opening our 4th location in March 2023</h1>
                <p class="lead my-3">Multiple lines of text that form the lede, informing new readers quickly and
                    efficiently about what’s most interesting in this post’s contents.</p>
                <p class="lead mb-0"><a href="#" class="text-white fw-bold">Continue reading...</a></p>
            </div>
    </div>

The full example code can be downloaded from here.

2

Answers


  1. You will want the background property, you can attach a URL to it.
    You may then want to Apply a filter to a background image

    .headerObject {
      height: 100px;
      width: 300px;
      background: url("https://cataas.com/cat");
      background-size: cover;
    }
    <div class="headerObject">
      Hello World
    </div>
    Login or Signup to reply.
  2. Add a background property to the div:

    <div style="background-image: URL('www.server.address/image.jpg');">
    </div>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search