S
S
SHAKIRA2019-09-22 13:35:14
css
SHAKIRA, 2019-09-22 13:35:14

How to set a separate image for a computer and a separate one for a phone in the header on bootstrap?

Here on this example On the phone you need to display a different photo

Answer the question

In order to leave comments, you need to log in

3 answer(s)
W
WapSter, 2019-09-22
@SHAKIRA

This is how it's done

<picture>
  <source media="(max-width: 799px)" srcset="elva-480w-close-portrait.jpg">
  <source media="(min-width: 800px)" srcset="elva-800w.jpg">
  <img src="elva-800w.jpg" alt="Chris standing up holding his daughter Elva">
</picture>

By the way, it's pretty easy to google. And watch the video of adequate developers, like Vadim Makeev. At least teach something Zhenya Zaletsky Alexander Osadchiy ))

E
Evgeny Zaletsky, 2019-09-22
@JZ_52

Through @media, if I correctly understood the essence of your question.

A
Alexander Osadchy, 2019-09-22
@DELUX

<div class="carousel-item active" role="listbox">
  <img src="img/slider/header.jpg" class="desktop">
  <img src="img/slider/header2.jpg" class="mobile">
</div>

<style>
  img.desktop {
    display: block;
  }

  img.mobile {
    display: none;
  }

  @media (max-width: 768px) {
    img.desktop {
      display: none;
    }

    img.mobile {
      display: block;
    }
  }
</style>

You were correctly answered above .. based on your example ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question