A
A
Anastasia2020-03-09 14:30:00
Bootstrap
Anastasia, 2020-03-09 14:30:00

How to make a responsive image using Bootstrap?

I have two blocks col-lg-6:

<div class="container">
            <div class="row">
                <div class="col-lg-6 mt-5">
                    <p>Text</p>
                </div>
                <div class="col-lg-6 mt-5 illustration_bg">
                    <img src="img/krolik_paczki.svg" alt="logo">
                </div>
            </div>
        </div>


One block must contain an image that must be larger than it. And the image should adapt according to the screen size. Now when the screen is reduced, a horizontal scroll appears and the image goes off the screen.

5e6628b6ba9a6707958384.png

In what way can this be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xdevelx, 2020-03-09
@develx

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

Bootstrap has a class.img-fluid

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question