Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何使图像适合旋转木马容器?_Css - Fatal编程技术网

Css 如何使图像适合旋转木马容器?

Css 如何使图像适合旋转木马容器?,css,Css,我正在尝试使旋转木马中不同高度和宽度的所有图像具有与旋转木马容器大小匹配的相同高度。'.carouselWrapper' HTML 试着看看这个例子。希望这就是你要找的。祝你一切顺利 .carousel-inner.项目{高度:500px;背景尺寸:封面;背景位置:中间;} 尝试查看此示例。希望这就是你要找的。祝你一切顺利 .carousel-inner.项目{高度:500px;背景尺寸:封面;背景位置:中间;} 在css中添加此代码 .slick-list, .s

我正在尝试使旋转木马中不同高度和宽度的所有图像具有与旋转木马容器大小匹配的相同高度。'.carouselWrapper'

HTML


试着看看这个例子。希望这就是你要找的。祝你一切顺利

.carousel-inner.项目{高度:500px;背景尺寸:封面;背景位置:中间;}



  • 尝试查看此示例。希望这就是你要找的。祝你一切顺利

    .carousel-inner.项目{高度:500px;背景尺寸:封面;背景位置:中间;}
    
    

  • 在css中添加此代码

    .slick-list, .slick-track {
      height: 100%;
    }
    
    .slick-slide img{
      width: fit-content;
    }
    

    在css中添加此代码

    .slick-list, .slick-track {
      height: 100%;
    }
    
    .slick-slide img{
      width: fit-content;
    }
    

    看看这是否是你想要的,我只是继承了“旋转木马div”中的img,并将div设置为100%

        .carousel{  max-height:100%; overflow:hidden;}
        .carousel div {  width:100%; height: 100%;  }
    
    .carousel div img { 
        max-width:100% ;
      max-height:100%;
      width:auto;
        margin: auto; 
    }
    
        .carouselWrapper {
            margin: 0px;
            height: 80vh;
            width: 100
        }
    
    
        .carousel{
          width: 100%;
            height: 100%;
          margin:0px auto;
        }
    
    这就是结果
    看看这是否是你想要的,我只是继承了“carousel div”中的img,并将div设置为100%

        .carousel{  max-height:100%; overflow:hidden;}
        .carousel div {  width:100%; height: 100%;  }
    
    .carousel div img { 
        max-width:100% ;
      max-height:100%;
      width:auto;
        margin: auto; 
    }
    
        .carouselWrapper {
            margin: 0px;
            height: 80vh;
            width: 100
        }
    
    
        .carousel{
          width: 100%;
            height: 100%;
          margin:0px auto;
        }
    
    这就是结果

    这是扭曲图像!这是扭曲的图像!我不希望图像被扭曲我希望所有图像高度相同,但保持其回顾宽度我在旋转木马div img中进行更新,请检查这是否是您想要的,结果是以下图像这在图像大小方面非常有效,但是,旋转木马一次只显示一个图像,在显示下一个和上一个图像的部分之前,如我的代码笔示例中所示。我不希望图像失真。我希望所有图像的高度相同,但保持其追溯宽度。我在.carousel div img中进行更新,请检查这是否是您想要的,结果是下面的图像这在图像大小方面非常有效,但是旋转木马一次只显示一个图像,在此之前它将显示下一个和上一个图像的部分,如我的代码笔示例中所示