Equal row sizes in the Bootstrap framework

I am trying my best to explain the situation. Currently, I am utilizing bootstrap for a project where I have two columns - one containing an image on the left and the other with a title and description on the right. My goal is to make the photo fill the entire available area of the column and dynamically increase its height as more text is added, similar to a cover illustration. Any help or suggestions would be greatly appreciated. Thank you.

So far, I attempted to set the height of the image in CSS, but this resulted in a static value which defeats the purpose of having it dynamic. Here's how it looks currently: example

    <div id="audi" class="row mt-4">
    <!-- Space for carousel -->
    <div class="col-md-9 addpadding">
        <div id="myCarousel" class="carousel slide" data-interval="false">
            <!-- Indicators -->
            <ol class="carousel-indicators">
                <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
                <li data-target="#myCarousel" data-slide-to="1"></li>
                <li data-target="#myCarousel" data-slide-to="2"></li>
            </ol>

            <!-- Carousel slides -->
            <div class="carousel-inner">
                <div class="carousel-item active">
                    <img src="car.jpg" alt="Audi - Photo 1" class="img-fluid custom-carousel-image">
                </div>
                <div class="carousel-item">
                    <img src="car1.jpg" alt="Audi - Photo 2" class="img-fluid custom-carousel-image">
                </div>
                <div class="carousel-item">
                    <img src="car2.jpg" alt="Audi - Photo 3" class="img-fluid custom-carousel-image">
                </div>
            </div>

            <!-- Navigation arrows -->
            <a class="carousel-control-prev" href="#myCarousel" role="button" data-slide="prev">
                <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                <span class="sr-only">Previous</span>
            </a>
            <a class="carousel-control-next" href="#myCarousel" role="button" data-slide="next">
                <span class="carousel-control-next-icon" aria-hidden="true"></span>
                <span class="sr-only">Next</span>
            </a>
        </div>
    </div>
        <!-- Area for title and description on the right side -->
        <div class="col-md-3">
            <div class="d-flex flex-column justify-content-center h-100">
                <h2 class="pb-1 car-title">Audi</h2>
                <!-- Pill Badges in one line with center alignment -->
                <div class="align-items-center mb-1 mt-1">
                    <span class="badge badge-pill badge-ultra mr-1"><i class="fa-regular fa-calendar"></i>&nbsp2022</span>
                    <span class="badge badge-pill badge-ultra mr-1"><i class="fa-solid fa-fire-flame-simple"></i>&nbsp310 HP</span>
                    <span class="badge badge-pill badge-ultra mr-1"><i class="fa-solid fa-shuffle"></i>&nbspAutomatic</span>
                    <span class="badge badge-pill badge-ultra"><i class="fa-solid fa-gas-pump"></i>&nbspGasoline</span>
                </div>
                <p class="car-description mt-1">description.</p>
                <!-- Button "Learn More" -->
                <a href="#" class="btn-learn-more mt-1">Check</a>
                <div class="mt-3">
                    <h2 class="rent-info">Terms</h2>
                    <ul class="rent-info-list">
                        <li><i class="fa-regular fa-circle-check"></i>1.</li>
                        <li><i class="fa-regular fa-circle-check"></i>2.</li>
                        <li><i class="fa-regular fa-circle-check"></i>3</li>
                        <li><i class="fa-regular fa-circle-check"></i>4.</li>
                    </ul>
                </div>
<div class="mt-2">
    <h2 class="priceHeader">Price List</h2>
    <ul class="price-list">
        <li><strong>Day:</strong>1 zł</li>
    </ul>
</div>
                </div>
            </div>
        </div>

CSS:

.carousel {
    position: relative;
}

.carousel-inner {
    position: relative;
    width: 100%;
    overflow: hidden;
}
.carousel-item {
    position: relative;
    display: none;
    float: left;
    width: 100%;
    margin-right: -100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transition: -webkit-transform .6s ease-in-out;
    transition: transform .6s ease-in-out;
    transition: transform .6s ease-in-out,-webkit-transform .6s ease-in-out;
}

Answer №1

To ensure your <img> elements display correctly, add height: 100% to the parent container and apply object-fit: cover; along with max-height: 100% directly on the <img> elements.

For more information about object-fit, check out the official documentation.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue when activating Materialize Bootstrap

I'm facing an issue with my code. I have implemented a feature where a modal should be triggered after a user successfully adds a new user. However, I am using Materialize and the modal is not being triggered. Below is a snippet of my code: <div i ...

Django - tallying timer in action

Looking to add a timer that begins when accessing this template: {% block content %} <h3>C-Test</h3> <p>In the text below, some word endings are missing. The gap is about half the length of the word, so you need to fill in the rest ...

Place the image at the center of the div element

I'm having a hard time aligning this image in the center of my divs. No matter what I do, the image ends up either slightly off-center or stuck to the edges of the page. I've experimented with placing it within a row using Bootstrap's grid ...

Unlocking the API endpoints within nested arrays in a React project

{ [ "quicktype_id": 1, "quicktype": "Laptops", "qucik_details": [ { "type_name": "car", "type_img": "car_img" }, { "type_name": "van", "type_img": ...

The issue with CSS filter invert not functioning properly in Mozilla Firefox is causing complications

I am currently developing a small Firefox add-on designed to make reading pages at night more comfortable. The goal is to invert page colors without affecting images. Here is the code snippet I am using: document.body.style.filter = "invert(100%)"; var i ...

Adaptable Bootstrap Button that Adjusts to Different Screen Sizes

I want this button to adjust its size according to the screen dimensions. The current code keeps the button fixed in place. See below for the code snippet. <button type="button" [className]="'btn btn-block m-0'" kendoButton ...

Using the combination of Chrome browser, Lucida Grande font, and word-wrap

Recently, I encountered a unique situation in Chrome where an odd combination of styles led to an issue. To help illustrate the problem, I created a fiddle which can be viewed here: http://jsfiddle.net/C3CbF/1/ This particular issue is only visible if you ...

Menu options submerged beneath the surface of a concealed container with overflow property

Attempting to enhance the ui-grid by adding more options to each row using the "3 dots" approach. However, encountered an issue where the dropdown menu extends beyond the screen due to the use of position: absolute. Unable to switch to position: relative b ...

Tips on targeting a node that is dynamically generated within a function and styling it externally

Is there a way to style or change divs created within a function, but without making the change within that same function? Since variables are in the local scope of functions, it can be challenging to access these created divs for future styling or changes ...

The image is non-adjustable to different screen sizes

Currently, I am in the process of revamping a friend's website using Next.js and Tailwind. However, I've encountered a challenge with the background image specifically on iPhones. While it appears fine on browsers like Chrome and Safari as well a ...

Divergent Bootstrap layouts for different devices

https://i.sstatic.net/g1YeJ.png I am working on creating a layout where I want to display certain content differently based on whether the user is viewing it on a mobile or desktop device. The current approach I have taken involves duplicating some divs ...

When a button is undersized, the click event may not register

In my angular application, I have developed a directive for a tinyMCE editor. Upon setup, I have implemented two handlers: one for the blur event to hide the toolbar and another for the click event to show it. Additionally, I have created another directive ...

Effortlessly switch between CSS animation styles while adjusting animation settings

My HTML element with animation is defined as follows: <div id="box"></div> The box starts by moving 200 pixels to the right, taking 4 seconds to complete. .anim { animation-name: anim; animation-duration: 4s; animation-t ...

Ways to retrieve the href attribute value from an element in Python/Selenium even when there is no explicit href attribute present

I am facing an issue with retrieving the URL link from an element using the get_attribute('href') method. It returns a null value, as if the element does not have a href attribute. webdriver.find_element_by_xpath('//*[@id="__next"] ...

Browser switch dependent on operating system

Recently, a guest raised concerns about a DIV element covering the content of the page. There is an issue with a popup that is supposed to only appear when the mouse hovers over its container: <td class="ref" id="myContainer"> <div><a ...

Is there a way to connect two tables using CSS pseudo-selectors?

Is there a way to make two separate tables interact with each other using CSS pseudo-selectors? I have a data table and an auto-numbered table, and I want the rows to highlight in both tables when hovering over a cell in one of them. I've tried using ...

My PHP file is throwing an error that involves converting an array to a string and an uncaught PDOException with the SQLSTATE[HY093] code

I'm encountering an issue with this file. Here are the error messages: Warning: Array to string conversion in C:\xampp\htdocs\backhaul-dispatcher\login\process.php on line 46. Fatal error: Uncaught PDOException: SQLSTATE[HY09 ...

Error encountered while validating jQuery word cloud

Can anyone please assist me with validating a jQuery word cloud in HTML5? I'm encountering issues with all of the rel values showing this error message: "Bad value 1 for attribute rel on element a: Not an absolute IRI. The string 1 is not a registere ...

What could be causing the whitespace around this element when using SASS from Refills / Bourbon.io?

I've recently started using the impressive SASS framework, Boubon.io created by the talented team at thoughtbot. As I experiment with their supplied templates (known as Refills), I'm finding that Bourbon.io serves as a versatile alternative to po ...

What is the best way to ensure that the sidebar appears after the content on mobile devices, even when there are full-width blocks within

I attempted to enclose fixed-width content and sidebar within a common container, but when it came to mobile devices, I could only come up with a solution where the sidebar is positioned after the content and before the full-width content. However, this ar ...