'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



Solution 1:[1]

You need to use slider height as calc attribute For example

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.

Solution 2:[2]

Using an object after it has been destructed is undefined behaviour, therefore the compiler is under no obligation to ensure that your code will work as you expect. It is free to assume that the value of i after the destructor is run doesn't matter so it can make optimisations accordingly, it may even be that the optimiser is simply not written to handle such a case which is why you see a result of 0 which may be some default value. Again this is a completely legal thing for the compiler to do as your code's behaviour is undefined, you're lucky it doesn't just crash.

You can see this is probably what's happening by the fact that your code "works" when optimisations are disabled.

Solution 3:[3]

Compilers are allowed to assume that Undefined Behavior does not happen, up to assuming that your entire program won't run. In this case, it just assumed the do ... while(false) loop does not run. That too is a a valid assumption.

This is not a matter of opinion. If you're trying to argue that a do...while(false) loop runs once, you're arguing that the statement works as defined by the C++ Standard. But the C++ Standard does not apply at all to programs with Undefined Behavior.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sahil Palad
Solution 2 Alan Birtles
Solution 3 MSalters