首页 > 解决方案 > 全屏图像不适用于 ipad,只有 css 和 html

问题描述

有人可以帮我解决我的问题吗?我不知道如何诊断这种功能障碍。我正在建立网站,但在我的网站开始时出现全屏图像问题。当我在 chrome 中尝试响应模式并将大小更改为 ipad 大小或任何其他移动设备时,一切都很好,但我的 ipad 图像在 safari 甚至 chrome 上都无法正常工作。当我仅使用此 img 启动站点而没有其他代码时,它可以在 ipad 上运行,因此问题可能是一切...

它在平板电脑上的外观:(imgur 链接)

这就是我想让它看起来的方式:http: //testwebsite.orkiestramp.pl/

或者您可以查看照片:

它在计算机上的外观(chrome 等)(imgur 链接)

这是代码:

body {
  font-family: 'Lato', sans-serif;
}

/* START HEADER (COUPLE PHOTO)*/
#header-slider { 
  background: url("https://images.unsplash.com/photo-1505150099521-fde7970bcc3a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80") center;
  height: 100vh;
  /* width: 100%/vm? Problems.*/
  background-size: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background-attachment: fixed;
}

.first, .second{
  text-align: center;
  color: white;
  font-style: italic;
}

.first {
  margin-top: 40vh;
  font-size: 6vw;
}

.second {
  font-size: 4vw;
}
/* END HEADER (COUPLE PHOTO)*/

.header-text {
  text-align: center;
  font-family: 'Alex Brush';
  font-size: 2.5em;
  padding-top: 0.7em;
}

h2.header-text {
  color: #f14e78;
}
/* .pre-main {
  text-align: center;
} */

/* START MAIN (MAPS, DATES)*/
.main-page {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  text-align: center;
  flex-wrap: wrap-reverse;
  padding: 1.8em;
}

.main-text {
  color: #f14e78;
  font-family: 'Alex Brush';
  font-size: 2em;
}

iframe {
  height: 20em;
  width: 100%;
}

a{
  text-decoration: none;
  color: #f14e78;
}

.main-left{
  flex-basis: 20%;
}

.main-right {
  flex-basis: 50%;
}
/* END MAIN (MAPS, DATES)*/

/* START FOOTER*/
.footer {
  background-color:#333333;
  align-items: center;
  display: flex;
  font-size: 1.4em;
  justify-content: center;
  height: 150px;
}

/* BOOTSTRAP SLIDER */
#slider-images {
  padding: 20px 130px;
}
/* BOOTSTRAP SLIDER END */

.footer p {
  color: #ffffff;
  font-size: 18px;
  letter-spacing: 1px;
}
/* END FOOTER*/

/* Timeline START */
/* Timeline holder */
ul.timeline {
    list-style-type: none;
    position: relative;
    padding-left: 1.5rem;
}

 /* Timeline vertical line */
ul.timeline:before {
    content: ' ';
    background: #f14e78;
    display: inline-block;
    position: absolute;
    left: 16px;
    width: 4px;
    height: 100%;
    z-index: 400;
    border-radius: 1rem;
}

li.timeline-item {
    margin: 20px 0;
}

/* Timeline item arrow */
.timeline-arrow {
    border-top: 0.5rem solid transparent;
    border-right: 0.5rem solid #f14e78;
    border-bottom: 0.5rem solid transparent;
    display: block;
    position: absolute;
    left: 2rem;
}

/* Timeline item circle marker */
li.timeline-item::before {
    content: ' ';
    background: #f14e78;
    display: inline-block;
    position: absolute;
    border-radius: 50%;
    border: 3px solid #f14e78;
    left: 11px;
    width: 14px;
    height: 14px;
    z-index: 400;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

/* END TIMELINE */

@media screen and (max-width: 1024px) {
  .first {
  font-size: 9vw;
}

  .second {
  font-size: 7vw;
}

  .main-page {
  flex-direction: column;
  padding: 0.5em;
}
  .main-right {
  width: 100%;
  }

  #slider-images {
  padding: 10px;
  }
}


@supports (-ms-ime-align:auto) {
    .main-left{
  flex-basis: 30%;
}

.main-right {
  flex-basis: 70%;
}
    }
}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Wesele Dorota & Marcin</title>
  <meta name="description" content="Niezbedne informacje dla gosci na temat wesela Doroty i Marcina"/>
  <meta name="author" content="Bendzi" />
  <link rel="stylesheet" href="normalize.css">
  <link rel="stylesheet" href="style.css">
  <link rel="shortcut icon" href="image/favicon.png" type="image/x-icon"/>
  <link href='https://fonts.googleapis.com/css?family=Alex Brush' rel='stylesheet'>
  <link href="https://fonts.googleapis.com/css?family=Lato&display=swap" rel="stylesheet">
  
  <!-- Bootstrap example slider -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
  
 
</head>

<body>
  <section id="header-slider">
    <div class="header-text">
      <h1 class ="first">Dorota & Marcin</h1>
      <h1 class="second">27 luty 2021</h1>
    </div>
  </section>
  
 <!-- <h2 class="header-text">Pobieramy sie!</h2>
    <div class="pre-main">   
      <p>Jesteśmy bardzo podekscytowani, że możemy spędzić ten wyjątkowy dla nas dzień właśnie z Wami - naszymi bliskimi.</p>
    </div>-->
  
  <h2 class="header-text">Kiedy i gdzie?</h2>
  
  <section class ="main-page">
    <div class="main-left">
      <img class="ceremoney png" src="image/Ceremoney.png" alt="ceremoney.png">
      <h3 class="main-text">Ceremonia</h3>
      <p>27 sluty 2021</p>
      <p><b>15:00</b></p>
      <a href="http://sanktuariummiejscepiastowe.pl/">Sanktuarium Św. Michała Archanioła <br> i Bł. Bronisława Markiewicza</a>
      <p>ul. Ks. Markiewicza 25 <b>Miejsce Piastowe</b></p>
    </div>
    
    
    <div class="main-right">
      <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d24584.395338500635!2d21.772600937713957!3d49.63326377402741!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x473c47a53cce9511%3A0x8b648ba7242fd980!2sSanktuarium%20%C5%9Aw.%20Micha%C5%82a%20Archanio%C5%82a%20i%20B%C5%82.%20Bronis%C5%82awa%20Markiewicza%20w%20Miejscu%20Piastowym%20-%20Michalici!5e0!3m2!1spl!2spl!4v1577625015874!5m2!1spl!2spl"></iframe>
    </div>

  </section>
  <section class ="main-page">
    <div class="main-left">
      <img class="wedding png" src="image/Wedding.png" alt="wedding.png">
      <img class="bed png" src="image/Bed.png" alt="bed.png">
      <h3 class="main-text">Wesele i nocleg</h3>
      <p>21 sluty 2021</p>
      <p><b>16:30</b></p>
      <a href="http://www.g-katering.pl/">Kompleks Rekreacyjno - Rozrywkowy DWA - SERCA</a>
      <p>ul. Bieszczadzka 80 <b>Krosno</b></p>
    </div>
    
    
    <div class="main-right">
      <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d29233.65083701806!2d21.76895992061611!3d49.637073691267375!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x473c46253abe1567%3A0xc8612fafb0d56ccb!2sKompleks%20Rekreacyjno%20-%20Rozrywkowy%20DWA%20-%20SERCA!5e0!3m2!1spl!2sus!4v1577624991125!5m2!1spl!2sus"></iframe>
    </div>
    
  </section>
  
  <h2 class="header-text">Nasza historia</h2>
  
  <!-- TIMELINE BOOTSTRAP -->
    <div class="container py-5">
       <div class="row">
          <div class="col-lg-7 mx-auto">

                <ul class="timeline">
                    <li class="timeline-item bg-white rounded ml-3 p-4 shadow">
                        <div class="timeline-arrow"></div>
                        <h2 class="h5 mb-0">Pierwszy spotkanie</h2><span class="small text-gray"><i class="fa fa-clock-o mr-1"></i>21 Marca, 2019</span>
                        <img style="width: 100%;" src="https://images.unsplash.com/photo-1505150099521-fde7970bcc3a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80">

                    </li>
                    <li class="timeline-item bg-white rounded ml-3 p-4 shadow">
                        <div class="timeline-arrow"></div>
                        <h2 class="h5 mb-0">Pierwsza podróż</h2><span class="small text-gray"><i class="fa fa-clock-o mr-1"></i>5 Września, 2019</span>
                        <img style="width: 100%;height: 100%;" src="https://images.unsplash.com/photo-1505150099521-fde7970bcc3a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80">

                    </li>
                    <li class="timeline-item bg-white rounded ml-3 p-4 shadow">
                        <div class="timeline-arrow"></div>
                        <h2 class="h5 mb-0">Pierwsze spotkanie</h2><span class="small text-gray"><i class="fa fa-clock-o mr-1"></i>18 Czerwca, 2019</span>
                        <img style="width: 100%;height: 100%;" src="https://images.unsplash.com/photo-1505150099521-fde7970bcc3a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80">

                    </li>
                    <li class="timeline-item bg-white rounded ml-3 p-4 shadow">
                        <div class="timeline-arrow"></div>
                        <h2 class="h5 mb-0">Pierwsza podróż</h2><span class="small text-gray"><i class="fa fa-clock-o mr-1"></i>10 Października, 2019</span>
                        <img style="width: 100%;height: 100%;" src="https://images.unsplash.com/photo-1505150099521-fde7970bcc3a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80">
                    </li>
                </ul>

           </div>
        </div>
    </div>
  
  <!-- BOOTRTRAP EXAMPLE SLIDER -->
  <section id="slider-images">
    <div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
      <div class="carousel-inner">
        <div class="carousel-item active">
        <img class="d-block w-100" src="https://images.unsplash.com/photo-1505150099521-fde7970bcc3a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80" alt="First slide">
        </div>
        <div class="carousel-item">
        <img class="d-block w-100" src="https://images.unsplash.com/photo-1505150099521-fde7970bcc3a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80" alt="Second slide">
        </div>
        <div class="carousel-item">
        <img class="d-block w-100" src="https://images.unsplash.com/photo-1505150099521-fde7970bcc3a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80" alt="Third slide">
        </div>
      </div>
  <a class="carousel-control-prev" href="#carouselExampleControls" 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="#carouselExampleControls" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
    </div>
  </section>
  
  
  
  <section class="footer">
    <p>Dorota: 823 123 123<br> Marcin: 783 213 212</p>
  </section>
  
</body>
</html>

标签: htmlcss

解决方案


我相信问题出在您的 #header-slider 上:

background-attachment: fixed;

你可以试试没有这条线吗?如果没问题,有办法让 iPad 不计算某些规则

我希望这对你有用!我知道我很久以前就遇到过你的问题,请告诉我。:)


推荐阅读