Trouble ensuring responsive height for Bootstrap 4 images

Seeking assistance with an issue in Bootstrap 4 related to responsive image height. Within a row containing four columns, the 2nd and 3rd columns occupy 5 columns each. The 2nd column contains an image while the 3rd column holds text. The challenge arises when the text in the third column expands, causing the size of the image in the 2nd column to remain responsive and match the height of the text in the 3rd column. Attempts using img-fluid from Bootstrap 4 have been unsuccessful. Below is a snippet of my code along with a link to JSFiddle for reference: JSFiddle Link

  .meet-designer-tile{margin-top:80px;margin-bottom:40px;}
    
    .collection-details .btn-collection-details{
        border: none;
        border-radius: 0;
        padding: 15px 63px;
        color: #41173F !important;
        font-size: 14px;
        line-height: 20px !important;
        text-align: center;
        margin-top: 20px;
        text-decoration: none !important;
        border: 1px solid black;
        
    }
    
    ... (CSS code continues) ...

</code></pre>
<pre><code><!-- 
  Bootstrap docs: https://getbootstrap.com/docs
-->

<div class="container">
  <div class="row d-flex flexrow">
            <div class="col col-12 col-md-5 offset-md-1  designerPhoto">
                
                    <picture>     
                     <source media="(max-width:767px)" srcset="https://c8.alamy.com/comp/PNE9YE/milkmaid-and-dog-in-a-landscape-painting-watercolor-height-168-mm-661-in-width-200-mm-787-in-author-circle-of-edward-dayes-PNE9YE.jpg" class="lazy designerTileShadow img-fluid"/>
                      <img src="https://c8.alamy.com/comp/PNE9YE/milkmaid-and-dog-in-a-landscape-painting-watercolor-height-168-mm-661-in-width-200-mm-787-in-author-circle-of-edward-dayes-PNE9YE.jpg" srcset="https://c8.alamy.com/comp/PNE9YE/milkmaid-and-dog-in-a-landscape-painting-watercolor-height-168-mm-661-in-width-200-mm-787-in-author-circle-of-edward-dayes-PNE9YE.jpg 2x" class="stretch object-fit  designerTileShadow img-fluid"/>  
                    </picture>
            </div>
         
            ... (HTML code continues) ...

Any help would be greatly appreciated. Thank you, Bee

Answer №1

I trust this information will be beneficial to you. If you are using the mobile version, you have the option to set the height using media queries.

  .meet-designer-tile{margin-top:80px;margin-bottom:40px;}
    
    .collection-details .btn-collection-details{
        border: none;
        border-radius: 0;
        padding: 15px 63px;
        color: #41173F !important;
        font-size: 14px;
        line-height: 20px !important;
        text-align: center;
        margin-top: 20px;
        text-decoration: none !important;
        border: 1px solid black;
        
    }
    
    .collection-details .btn-collection-details:hover {
    background-color: transparent !important;
    }
    
    
    .collection-details-spacing{
        margin-top:200px;
    }
    
    .designerTileShadow{
          box-shadow: 0 9px 20px 0 rgba(0,0,0,0.1);

    }
    
    .meet-designer-tile .content{
        padding: 0px 40px;
    }
    
    .meet-designer-tile .designerPhoto{
        padding-right: 0px;
    }
    
    .meet-designer-tile .content{
        padding: 0px 40px;
    }
    
    /* Responsive Tablet */
    @media(max-width:767px){
       
        .meet-designer-tile .designerPhoto{
            padding: 0px !important;
        }
        
        .meet-designer-tile .content{
            padding:20px 20px 30px 20px;
        }
    }
    
    picture img {
      object-fit: cover;
  
    }
    
    picture {
      height: 100%;
    }
    



    
<!-- 
  Bootstrap docs: https://getbootstrap.com/docs
-->

<div class="container">
  <div class="row d-flex flexrow">
            <div class="col col-12 col-md-5 offset-md-1 d-flex designerPhoto">
                
                    <picture class="d-flex">     
                     <source media="(max-width:767px)" srcset="https://c8.alamy.com/comp/PNE9YE/milkmaid-and-dog-in-a-landscape-painting-watercolor-height-168-mm-661-in-width-200-mm-787-in-author-circle-of-edward-dayes-PNE9YE.jpg" class="lazy designerTileShadow img-fluid"/>
                      <img src="https://c8.alamy.com/comp/PNE9YE/milkmaid-and-dog-in-a-landscape-painting-watercolor-height-168-mm-661-in-width-200-mm-787-in-author-circle-of-edward-dayes-PNE9YE.jpg" srcset="https://c8.alamy.com/comp/PNE9YE/milkmaid-and-dog-in-a-landscape-painting-watercolor-height-168-mm-661-in-width-200-mm-787-in-author-circle-of-edward-dayes-PNE9YE.jpg 2x" class="stretch object-fit  designerTileShadow img-fluid"/>  
                    </picture>
            </div>
         
            <div class="d-md-flex col-12 col-md-5  mt-md-0 justify-content-center align-items-center designerTileShadow pl-0">
                    <div class="content text-left">
                        <h5>GET ACQUAINTED WITH THE ARTIST</h5>
                        <h2>Ali Samar</h2>
                        <p class="body-font">I am a creative artist with years of experience in designing. I bring unique and innovative ideas to life through my work.</p>
                    </div>
            </div>
         
         
            <div class="col col-12 col-md-1"></div>
                
     </div>
</div>

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

The Bootstrap 4 dropdown seems to have a one-time use limit

I'm currently working on a dropdown menu using Bootstrap 4. The dropdown menu is functional, but I'm facing an issue where it only toggles once. I have tried various solutions recommended on different websites, but none of them seem to work. Belo ...

Unique CSS content for varied designs

I have a CSS code snippet for a tooltip: .GeneralTooltip { background:#c7430f; margin:0 auto; text-transform:uppercase; font-family:Arial, sans-serif; font-size:18px; vertical-align: middle; position:relative; } .GeneralTooltip::before { content:"This is ...

Developing an interactive input tab for user engagement

I'm in the process of developing a web application for my current university workplace. Currently, I am seeking guidance on how to create a dynamic user input form for our website using asp.net and c# in visual studio 2017. I'm struggling a bit w ...

Utilize Jquery to copy the parent element to the text field with just a click

I'm looking to have 4 buttons placed next to each URL, so that when you click on a button, the parent URL is copied to the corresponding text field of that button. I believe using jQuery would be the easiest way to achieve this, but I'm not sure ...

Inserting a PHP variable ($username) into a form field

<form method="POST"> <h1>Contact Us</h1> <span><h2 class="required">*Required</h2></span> <div class="input-group"> <label class="sr-only">First Name</label> <input class="text" ...

Utilizing FontAwesome icons instead of png images as a visual source

Is there anyone who can assist me? I currently have SiteSearch360 set up on my website with a full screen search bar that is activated by clicking on an image of a magnifying glass. My goal is to replace the default image (src="https://cdn.sitesearch360. ...

Show text on a button press in Angular

I have set up a group of three buttons using ngFor, each button has its own unique name stored in an array called buttonData[]. The buttonData array also includes corresponding text and images for each button. My goal is to display a specific text and imag ...

text shaped into a curve within a container

$().ready(function() { $('#demo1').circleType({fitText:true, radius: 180}); }); $().ready(function() { $('#example').arctext({radius: 250}); }); <script type="text/javascript" src="http://ajax.googleapis.com/ ...

How can you adjust a background image to perfectly fit across various screen sizes?

I am just starting out with web development and I am building a website using HTML/CSS. The background of my site looks good on my macbook pro, but when I try to view it on a larger screen, the background repeats and the content stays in the top left corne ...

After spending a while working on my React project, I started encountering errors consistently whenever I attempted to run the 'npm install' command

An issue has been encountered: '[email protected] requires a peer of [email protected] - 3 but none is installed. You must install peer dependencies yourself.' Has anyone else faced this error before? Can someone help me understand wha ...

The altered variable refuses to show up

Currently, I am working on a project to create a Skate Dice program that will select random numbers and display the results simultaneously. Unfortunately, I have encountered an issue where the randomly generated number is not being shown; instead, it dis ...

Issue with Bootstrap Alert functionality on local host page

My alert code isn't working as expected. I can't see anything on the screen, even though everything seems to be correct. I don't believe I'm missing any JavaScript functions since it's just a text alert. <div class="alert a ...

`Can a creation of this nature be accomplished?`

In my text input field, users can type messages to send to me. I'd like to add buttons on the page with symbols like "!", "XD", and "#". When someone clicks on a button, such as the "!" button, that corresponding symbol should be inserted into the tex ...

What is the method for displaying a file using a binary string as input?

Is there a way to display a PDF file from a binary string on a web browser? I know that for image files, we can use atob() and then <img src="data:image/png;base64,... But what about PDF files? Is there an equivalent method or syntax like ReadItAs("cont ...

Create a circular status button that overlays on top of another element using CSS

Looking to enhance my CSS skills! Seeking advice on creating a status button that changes color based on chat availability and positioning it on top of another button. https://i.sstatic.net/iU8wi.png ...

CSS - using !important alongside a variable

Is there a way to dynamically add an important tag to the CSS height property of #content located on line 7 in the code snippet below? I need to use the variable $newHeight to ensure flexibility. Can anyone provide guidance on how to append an !important ...

Is it feasible to conceal the "div" element of a broken image in Ionic 2/3?

Can anyone help me with hiding the "div" containing a broken image in Ionic 3? I was able to hide the image using "onerror", but the div itself didn't hide. Here is my code: <div *ngFor="let item of list;"> <div style="width: calc(100%/ ...

Extracting a parameter from a URL using C#

Imagine having a URL such as http://google.com/index.php?first=asd&second=mnb&third=lkj What is the method to extract the second value (mnb) using C#? ...

I need to condense my layout from three columns to just two columns in HTML

The html code for "Date Accessed" is meant to be in one column as a header, while the actual dates should be in another column, but somehow they are all appearing in a single column. I am having trouble figuring out why. <!DOCTYPE html> {% load stati ...

Adjust div elements to fit the size of the window

I'm currently working on designing a new web application's skeleton layout. I have come across some issues, particularly with CSS layouts and DIV. 1) Boxes 1 and 2 in the first column do not align with boxes 3 and 4 in the second and third colum ...