首页 > 解决方案 > 如何解决在 div 中间设置滑动器位置的问题

问题描述

我正在尝试在 div 容器的中间设置 swiper,看起来它仅适用于 iphone 5 宽度。我为此设置了一个班级,但它不起作用。谁能向我解释如何解决它?

.html 文件

  <swiper class="align-middle" #swiper [config]="swiperconfig">
      <ng-container *ngFor="let item of data;">
          <div class="swiper-slide align-middle" >
              <app-ds-widget-component #card [item]="item" [totalFlow]="data.totalFlow"></app-ds-widget-component>
          </div>

      </ng-container>
  </swiper>
</div>

.scss 文件

@media (min-width: 570px) and (max-width: 1024px){
  .swiper-view {
    justify-content: center;
    margin-left: auto;
    margin-right: auto;

  }
}
@media only screen
and (min-device-width : 320px)
and (max-device-width : 568px) {
  .swiper-view {
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}
}

标签: sassmedia-queries

解决方案


推荐阅读