使用显示时,图像在恢复窗口时移动

发布于 2025-02-13 02:13:58 字数 2020 浏览 0 评论 0原文

这是我的SASS和HTML代码。

我想知道为什么我的Caroulsel图像在调整窗户大小时向左移动,有人可以帮我吗?我搜索了多个stackoverflow,但找不到答案。 以某种方式,图像不会稳定地调整大小并向左移动。我想知道,在重新分配窗口时,如何将图像保持在相同的位置。

.carousel-wrapper {
  position: relative;
  // margin: auto;
  border: 4px solid red;
  overflow: hidden;
  //ul
  .facebook_album_list {
    display: flex;
    .album_list_item {
      min-width: 100%;
      a {
        img {
          width: 100%;
          aspect-ratio: 16/9;
          max-height: 300px;
        }
      }
    }
  }
  .carousel_button {
    position: absolute;
    z-index: 2;
    height: 100%;
    cursor: pointer;
    display: grid;
    justify-content: center;
    align-items: center;
    color: rgb(255, 255, 255);
    &:hover {
      .fa-solid {
        transform: scale(1.2);
      }
    }
    .fa-solid {
      font-size: 1rem;
      padding: 1rem;
      border-radius: 50%;
      transform: scale(1);
      background-color: rgb(212, 88, 0);
    }
  }
  #previousbtn {
    left: 0;
  }
  #nextbtn {
    right: 0;
  }
}
<div class="carousel-wrapper" aria-label="Photo gallery" data-carousel>
  <ul class="facebook_album_list album_list" data-carousel-list>

    <li class="album_list_item slide_item" data-carousel-list-item>
      <a href="">
        <img class="album_list_item_img" data-carousel-img src="" loading="lazy">
      </a>
    </li>

    <li class="album_list_item slide_item" data-carousel-list-item>
      <a href="">
        <img class="album_list_item_img" data-carousel-img src="" loading="lazy">
      </a>
    </li>

    <li class="album_list_item slide_item" data-carousel-list-item>
      <a href="">
        <img class="album_list_item_img" data-carousel-img src="" loading="lazy">
      </a>
    </li>

  </ul>
</div>

this is my sass and html code.

i would like to know why my caroulsel images moves to left when i resize the window can anyone help me ? i have search multiple stackoverflow but couldnt find the answer for it.
somehow the image doesnt resize acordingly and moves to left . i would like to know how can i keep the image on the same position when reisizng the window.

.carousel-wrapper {
  position: relative;
  // margin: auto;
  border: 4px solid red;
  overflow: hidden;
  //ul
  .facebook_album_list {
    display: flex;
    .album_list_item {
      min-width: 100%;
      a {
        img {
          width: 100%;
          aspect-ratio: 16/9;
          max-height: 300px;
        }
      }
    }
  }
  .carousel_button {
    position: absolute;
    z-index: 2;
    height: 100%;
    cursor: pointer;
    display: grid;
    justify-content: center;
    align-items: center;
    color: rgb(255, 255, 255);
    &:hover {
      .fa-solid {
        transform: scale(1.2);
      }
    }
    .fa-solid {
      font-size: 1rem;
      padding: 1rem;
      border-radius: 50%;
      transform: scale(1);
      background-color: rgb(212, 88, 0);
    }
  }
  #previousbtn {
    left: 0;
  }
  #nextbtn {
    right: 0;
  }
}
<div class="carousel-wrapper" aria-label="Photo gallery" data-carousel>
  <ul class="facebook_album_list album_list" data-carousel-list>

    <li class="album_list_item slide_item" data-carousel-list-item>
      <a href="">
        <img class="album_list_item_img" data-carousel-img src="" loading="lazy">
      </a>
    </li>

    <li class="album_list_item slide_item" data-carousel-list-item>
      <a href="">
        <img class="album_list_item_img" data-carousel-img src="" loading="lazy">
      </a>
    </li>

    <li class="album_list_item slide_item" data-carousel-list-item>
      <a href="">
        <img class="album_list_item_img" data-carousel-img src="" loading="lazy">
      </a>
    </li>

  </ul>
</div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文