Мне нужно, чтобы текст в карусели был отзывчивым - PullRequest
0 голосов
/ 22 февраля 2020

Я использовал bootstrap 4 класса и медиа-запросы, но текст исчезает, когда я просматриваю сайт по телефону. ----- любой текст --- ---- ----- любой текст ------- --- любой текст ---

        </div>
    </div>
    <div class="carousel-item">
        <img class="d-block w-100" src=" img2.png" alt="Second slide" style="height: auto">
        <div class="carousel-caption d-none d-md-block n28">
            <h1 class="n26 animated bounceInRight display-2" style="animation-delay: 0.5s">-----any text -------</h1>
            <h3 class="animated bounceInLeft" style="animation-delay: 0.5s">-----any text -------</h3>
        </div>
    </div>
    <div class="carousel-item">
        <img class="d-block w-100" src="img3.png" alt="Third slide" style="height: auto">
        <div class="carousel-caption d-none d-md-block n28">
            <h1 class="n26 animated bounceInRight display-2" style="animation-delay: 0.5s">-----any text -------</h1>
            <h3 class="animated bounceInLeft" style="animation-delay: 0.5s">-----any text -------</h3>
        </div>
    </div>

</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
</a>

  .carousel-caption{
position: absolute;
top: 30%;
transform: translateY(-50);}
 .carousel-caption h1{
font-size: 500%;}
 .carousel-caption h3{
font-size: 110%;
font-family: "Poppins", sans-serif;}

Ответы [ 2 ]

0 голосов
/ 22 февраля 2020

я сделал это и отзывчив. пожалуйста, проверь это. Спасибо

@media only screen and (max-width: 767px) {

.carousel-caption { display:none;}

}
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
  <ol class="carousel-indicators">
    <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
  </ol>
  <div class="carousel-inner">
    <div class="carousel-item active">
      <img class="d-block w-100" src="https://cruxnow.com/wp-content/uploads/2019/09/Natural-cemetery-Natuurbegraafplaats-Koningsakker-1024x576.jpg" alt="First slide">
      <div class="carousel-caption d-md-block n28">
            <h1 class="n26 animated bounceInRight display-2" style="animation-delay: 0.5s">-----any text -------</h1>
            <h3 class="animated bounceInLeft" style="animation-delay: 0.5s">-----any text -------</h3>
        </div>
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="https://cruxnow.com/wp-content/uploads/2019/09/Natural-cemetery-Natuurbegraafplaats-Koningsakker-1024x576.jpg" alt="Second slide">
      <div class="carousel-caption d-md-block n28">
            <h1 class="n26 animated bounceInRight display-2" style="animation-delay: 0.5s">-----any text -------</h1>
            <h3 class="animated bounceInLeft" style="animation-delay: 0.5s">-----any text -------</h3>
        </div>
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="https://cruxnow.com/wp-content/uploads/2019/09/Natural-cemetery-Natuurbegraafplaats-Koningsakker-1024x576.jpg" alt="Third slide">
      <div class="carousel-caption d-md-block n28">
            <h1 class="n26 animated bounceInRight display-2" style="animation-delay: 0.5s">-----any text -------</h1>
            <h3 class="animated bounceInLeft" style="animation-delay: 0.5s">-----any text -------</h3>
        </div>
    </div>
  </div>
  <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
0 голосов
/ 22 февраля 2020

Проверьте CSS в скрипте Media для классов вашего текста, возможно, для свойства display установлено значение none. либо эти классы "n26 animated bounceInRight display-2", либо эти "animated bounceInLeft".

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...