【问题标题】:How can i fix the size for my custom carousel如何固定自定义轮播的大小
【发布时间】:2022-01-20 00:22:44
【问题描述】:

我尝试将图像轮播添加到我的模态框,但轮播会针对不同的图像尺寸改变尺寸

【问题讨论】:

    标签: html css angular user-interface carousel


    【解决方案1】:

    您可以使用 css 为您的轮播设置固定高度,以便轮播框始终保持相同大小:

    . carousel{
      height:400px;
      width:300px;
    

    或者你可以用同样的方式为你在轮播中使用的每张图片设置高度和宽度

    . carousel_image{
      height:400px;
      width:300px;
    

    【讨论】:

      【解决方案2】:

      试试下面的代码:

      <ngb-carousel>
      <ng-template ngbSlide>  
      <img src="https://d2g9wbak88g7ch.cloudfront.net/bannerimages/46_inr.png" style="height:300px;width:100%">
      </ng-template>  
      </ngb-carousel>  

      【讨论】:

      • 如果您想保留图像的纵横比,也可以使用适合对象的样式。
      猜你喜欢
      • 2021-04-13
      • 1970-01-01
      • 2020-01-16
      • 1970-01-01
      • 2020-10-22
      • 2011-10-08
      • 2014-08-22
      • 2018-12-14
      相关资源
      最近更新 更多