Creating responsive images in Bootstrap columns

I've found a solution to my issue with large images, but I am still struggling with smaller images not fitting well into larger spaces.

Essentially, I created a CMS for a user who required templates with various bootstrap columns as content areas. Currently, he is dragging images into these areas using TinyMCE editors and saving them as HTML that displays on large screens (around 70 inches).

When dragging a huge image (several thousand pixels), it scales down nicely and works fine. However, he is currently attempting to add an image with smaller dimensions, and when displayed on the large screens, it appears very small (due to the smaller size).

Is there a way to adjust this so that smaller images can expand or grow responsively to fit the full column area?

<style type="text/css>
      html,
      body {
      height: 100vh;
      width: 100vw;
      overflow: hidden;
      }

      iframe{
      height:100% !important;
      width:100% !important;
      }

      .middle p{
      max-height:100%;
      margin-bottom:0;     
      display: flex
      }

      img {
      object-fit: scale-down;
      width: 100%; 
      height:100%;
      margin:0 auto;
      }
      #leftContent{
        display:flex;
        justify-content:center;
        align-items:center;
        overflow: hidden;
        height:100%;
      }
      #leftContent img{
          object-fit: contain;
      }
      .leftContent{
        max-width: 100%;
        max-height: 100%;
        height: auto;
        width: auto;
      }
      .leftContent> img{
        min-width:100%;
        min-height: 100%;
        width: auto;
        height: auto;
      }
      #rightContent{
        display:flex;
        justify-content:center;
        align-items:center;
        overflow: hidden;
        height:100%;
      }
      #rightContent img{
          object-fit: contain;
      }
      .rightContent{
        max-width: 100%;
        max-height: 100%;
        height: auto;
        width: auto;
      }
      .rightContent> img{
        min-width:100%;
        min-height: 100%;
        width: auto;
        height: auto;
      }
      /*END EDITOR RESPONSIVE STYLES*/



      .my-container {
      display: flex;
      flex-direction: column;
      justify-content: center;
      height: 100vh;
      width:100vw;
      }

      .my-container .top.row, 
      .my-container .row.bottom {
      flex-shrink: 0;
      }

      .my-container>.top [class^="col-"],
      .my-container>.bottom [class^="col-"] {
      background-color: #778899  ;
      color: white;
      text-align: center;
      }

      .my-container>.middle {
      flex-grow: 1;
      padding:30px;
      /*background-image: url('images/bg_green.svg');*/
      background-size: cover;
      }

      .my-container>.middle>* {
      }

      </style>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.css" rel="stylesheet"/>

<div class="container-fluid my-container d-flex h-100">
        <div class="row top">
          <h2>Top Row</h2>
        </div>

        <div class="row middle" id="middle" style="background-image: url();">
          <!-- Half Page Divs -->
          <div class="col-lg-6 leftColumn " id="leftColumn" style="align-items: center;">  
              <div class="leftContent" id="leftContent" style=" margin:auto; ">  
                <img src="https://via.placeholder.com/715x938 "> 
              </div>
          </div>
          <div class="col-lg-6 rightColumn" id="rightColumn"> 
            <div class="rightContent" id="rightContent" >
                <img src="https://via.placeholder.com/715x938 "> 
            </div>
          </div>
          <!-- End Half Page Divs -->
        </div>
        <!-- End Row Middle -->

        <div class="row bottom">
            <h2>Bottom Row</h2>
        </div>
      </div>

Answer №1

It seems like you have a good layout in place already, but if you want to make your images responsive, you can try using the class img-fluid. This will allow the image to scale with its parent element.

<img src="..." class="img-fluid" alt="Responsive image">

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

Exploring the process of web scraping from dynamic websites using C#

I am attempting to extract data from using HtmlAgilityPack. The website is dynamic in nature, displaying content after the page has fully loaded. Currently, my code retrieves the HTML of the loading bar using this method, but encounters a TargetInvocation ...

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"] ...

Tips for visually conveying the values of x and y using SVG symbols

I recently came across a blog post discussing the use of SVG symbols for icons, which inspired me to create representations of symbols using svg files. The original svgs I used had properties like x, y, height and width. However, when I tried adding these ...

What steps do I need to follow in order to create an AJAX application that functions similarly to node

As someone new to ajax, I am facing challenges while trying to create a forum software similar to nodebb. Despite having developed a php forum previously, its outdated appearance prompted me to seek alternatives like nodebb for a more modern look and feel. ...

creating styles for css elements using equations

I am curious about defining CSS element dimensions before they are rendered without using offset and jQuery. Is it possible to echo PHP into the width/height or position values? For example: <?php $width = 290px; $altwidth = 290; ?> <style> ...

Error message indicating that the event "OnkeyDown" is not in sync within the React application

Hey everyone! I'm a beginner in web development and I'm struggling to understand why the event "OnKeyDown" is triggered the second time. My task involves changing (increasing, decreasing) parts of a date (day, month, year, hour, minutes, seconds) ...

Is it possible to automate the process of clicking the "next" or "previous" button on a webpage after a video has finished playing?

Is it possible to automate clicking the "next" or "previous" button on a specific website? The buttons are not labeled as such but instead show the cartoon name and episode number. For example, increasing episode numbers indicate the "next" episode while d ...

"How can I make a dropdown open and close when a button is clicked, but also close when clicking outside of it at the same

One button click opens a dropdown, and it also closes when clicked outside. toggleAllCategories() { this.setState({ isOpenAllCategories: !this.state.isOpenAllCategories }); } The issue arises when attempting to open and close the dropdown by clic ...

Creating an Interactive Image Gallery with PHP

I need help merging my gallery template with my PHP code to display images fetched from a database. The gallery code is provided below: <body> <section class="gallery-block cards-gallery"> <div class="container&qu ...

When interacting with elements with the "user-select: none" property, WkWebView still allows text selection

When using an iOS iPad app with a single fullscreen WKWebView, an issue arises when long-pressing on an area with user-select:none - the first text in the next available area without user-select:none gets selected instead of being ignored. Is there a way t ...

Steps for implementing remote modals in Bootstrap 5 using CS HTML

I'm attempting to implement a remote modal window in Bootstrap 5 with C# MVC. The endpoint for the modal partial view is configured correctly. According to this discussion on Github, all that needs to be done is to call some JavaScript. However, it ...

identify when the bottom of a container is reached during scrolling through a window

On my website, I have a section with products displayed in the center of an HTML page. I am looking to implement an AJAX call that will load additional products when the user reaches the bottom of this product container by scrolling down. How can I detec ...

Here's a guide on how to display texts underneath icons in Buttons using Material UI

Currently, this is the Button I have displayed https://i.sstatic.net/YkHp0.png I am trying to figure out how to position the Dummy Button text beneath the icon. Can someone assist me with this? Below is my code snippet: <Button className={classes.d ...

What is preventing Kohana from reading my CSS?

Recently, I launched my website kipclip.com on the Kohana platform and added a new rental page. However, the CSS and JS files are not being applied to this page. I've looked into how these files are included in Kohana but haven't had any luck so ...

The lengthy string is not breaking into separate lines as expected in Internet Explorer

My querystring is quite long http://terra.cic.local/web/index.cfm//pm/uebersicht?sucheAufgeklappt=was%2Cwie%2Cwohin%2Cwann%2Cwer&sucheVon=&sucheBis=&sucheIstErsteSeiteAnzahlProdukteErmitteln=false&sucheIDReiseart=26&sucheHotelart=1081& ...

CSS: Apply unique padding to the last element without the use of additional classes

My challenge involves a div housing three images, each about 31% in width. The goal is to have padding between them, with the final image having no right padding so that collectively they match the width of a larger image above. Here's an example... ...

CSS issue: Font size

Can someone help me out with a CSS issue that has been tripping me up? I've been working with CSS for three years now, and this particular problem is stumping me. I have defined some styles in my CSS file that should be applied to the content of my w ...

In Android Kitkat 4.4.4, the Ionic navbar displays icons vertically when using the <ion-buttons end> feature

When viewing in the browser with ionic serve, everything looks fine. However, on an Android Kitkat device running version 4.4.4, the buttons on the right side of the navbar are displaying vertically instead of horizontally. <ion-navbar> <ion-ti ...

How can I center a <a> vertically within a list that has varying heights?

Help Needed: Alignment Issue with Anchor Tags in List I am facing a challenge with vertically aligning the anchor tags inside my list. The number of list items varies based on the pages of my website, so I have used display flex on the list and flex: 1 on ...

Seeking to develop a pair of functions for submitting data via my website's form

I need to pass form data to both Docusign and Zapier with just one button click using JavaScript. When the Submit button is pressed, I want the data to be sent to Zapier without opening a success page and then redirect to the Docusign page with all the in ...