简体   繁体   English

设置轮播(图像)高度等于窗口高度

[英]Setting Carousel (Images) Height Equal to Window Height

I have this page that loads a carousel but I want the carousel to fit in the window without having the vertical scrollbar as shown in the picture.我有这个加载轮播的页面,但我希望轮播适合窗口,而没有如图所示的垂直滚动条。 How can I achieve that please?请问我怎样才能做到这一点?

Page:页:

<div id="carouselIndicators" class="carousel slide"  data-bs-ride="carousel" style="margin-bottom:40px;">
    <div class="carousel-indicators">
        <button type="button" data-bs-target="#carouselIndicators" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
        <button type="button" data-bs-target="#carouselIndicators" data-bs-slide-to="1" aria-label="Slide 2"></button>
        <button type="button" data-bs-target="#carouselIndicators" data-bs-slide-to="2" aria-label="Slide 3"></button>
    </div>
    <div class="carousel-inner rounded-corners">
        <div class="carousel-item active">
            <img src="/images/carousel/carosel1.jpg" class="d-block w-100" alt="carosel1">
            <div class="carousel-caption d-none d-md-block">
                <h1 class="text-success fw-bold fst-italic font-monospace">Seamless Allocation of Subjects</h1>
                <p class="text-warning fst-italic">
                     ****************Some Text****************
                    </p>
            </div>
        </div>
        <div class="carousel-item">
            <img src="images/carousel/carosel2.jpg" class="d-block w-100" alt="carosel2">
            <div class="carousel-caption d-none d-md-block">
                <h1 class="text-success fw-bold fst-italic font-monospace">Even Distribution of Classes</h1>
                <p class="text-warning fst-italic">
                    ****************Some Text****************

                </p>
            </div>
        </div>
        <div class="carousel-item">
            <img src="images/carousel/carosel3.jpg" class="d-block w-100" alt="carosel3">
            <div class="carousel-caption d-none d-md-block">
                <h1 class="text-success fw-bold fst-italic font-monospace">Class Management</h1>
                <p class="text-warning fst-italic">
                   ****************Some Text****************
               </p>
            </div>
        </div>
    </div>
    <button class="carousel-control-prev" id="#carouselIndicators-prev" type="button" data-bs-target="#carouselIndicators" data-bs-slide="prev">
        <span class="carousel-control-prev-icon" aria-hidden="true"></span>
        <span class="visually-hidden">Previous</span>
    </button>
    <button class="carousel-control-next" id="#carouselIndicators-next" type="button" data-bs-target="#carouselIndicators" data-bs-slide="next">
        <span class="carousel-control-next-icon" aria-hidden="true"></span>
        <span class="visually-hidden">Next</span>
    </button>
</div>

Current View: click to view the rendered view当前视图:点击查看渲染视图

You need to use slider height as calc attribute For example您需要使用滑块高度作为 calc 属性 例如

height: calc(100vh - 0px); //Increase/decrease the value in pixel as needed

Then increase/decrease the value in pixels so that for every screen your slider will take windows height.然后增加/减少以像素为单位的值,以便对于每个屏幕,您的滑块都将采用窗口高度。 Let me know if this will work for you.让我知道这是否对您有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM