Three Pictures Accompanied by Text Below, Which Relocates Next to the Images on More Compact Displays

Although sharing images is not recommended, I believe it would greatly aid in conveying my idea.

I have three images that I want to display side by side (blue squares) with text below each one (red squares) on larger screens. For smaller screens, I prefer the text to be positioned beside the images, and for the image/text pairs to stack vertically.

I assume using Bootstrap would be the best approach. While I understand how to utilize Bootstrap Grid to make the images stack vertically on smaller screens, I'm unsure of how to achieve this combined effect.

Here is the code I have written so far, which displays the images next to each other on larger screens and stacks them vertically on smaller screens:

<div class="container">
    <div class="row">

         <div class="col-md d-flex justify-content-center justify-content-md-start">
             <img src="{% static 'home/img.png' %}" />
         </div>

         <div class="col-md d-flex justify-content-center justify-content-md-start">
             <img src="{% static 'home/img.png' %}" />
         </div>

         <div class="col-md d-flex justify-content-center justify-content-md-start">
             <img src="{% static 'home/img.png' %}" />
         </div>

    </div>
</div>

Thank you for your help.

https://i.sstatic.net/i0JDg.png

Answer №1

To make this work with bootstrap, you need to include flex-md-column.

When the screen size exceeds the md breakpoint, the text will be positioned below the image instead of beside it. By default, flexbox is set to row, so below the breakpoint it maintains this default setting, and above the breakpoint it switches to column.

<div class="col-md d-flex flex-md-column justify-content-center">
    <img src="{% static 'home/img.png' %}" />
</div>

Original Source: https://getbootstrap.com/docs/4.4/utilities/flex/#direction

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

Having Numerous HTML Tables All in One Page Accompanied by Written Content

I used to have a webpage with multiple (4) HTML tables all contained within one div that spanned the entire page, serving only as an indicator for the tables' starting point. It all worked perfectly until a recent Chrome update caused chaos with the t ...

Why do all the select boxes require two clicks to open the drop-down menu when the function is activated?

After implementing this code on my webpage, I noticed an issue where all select boxes required two clicks from the user to open the drop-down menu. The first click seemed to set focus on the box, and only on the second click would the drop-down actually ap ...

utilize bootstrap to align text at the end of columns within a row

How can I use Bootstrap 5 to arrange a div and a canvas in a row until the md breakpoint? I want the canvas to align immediately after the text ends, currently each part has equal width. Is there a way to remove the unused space from the div? https://i. ...

Browsing through database images and aligning them with CSS to the center

I am working on creating a single row of three centered images inside a div. Both the images and the div itself need to be centered on the page. The images will be contained within the div, here's what I have so far: HTML/PHP <?php $resul ...

Troubleshooting the fluid container problem in Bootstrap 3

I am currently working on a website using Bootstrap 3 framework. I have a specific section where I need to have two fluid containers placed side by side, each with different background colors. One of these containers should also include a background image ...

Choosing an option in react-select causes the page to unexpectedly shift

Encountering a problem with a mobile modal developed using react-select. The selectors are within a div with fixed height and overflow-y: scroll. Upon selecting an option for the 'Choose observer' select, the entire modal briefly jumps down in th ...

I'm having trouble changing the background color of a blank document in Brackets using external CSS

I have been utilizing Brackets for a project at school and attempting to align div tags side by side, but I am not seeing any changes in the visual display of the code. I started to suspect an issue with the external CSS, so I tried altering the background ...

Implementing CSS Pre-loading in an Angular Application with Webpack and Heroku

My current setup involves an Angular application (v4.0.1) with webpack deployed on Heroku. I have a loading spinner in place to show while the app is loading, and it works well locally. However, when deployed on Heroku, the loading spinner (specifically th ...

Display my search box when the button is activated

I have a button labeled "Search" that I want to click in order for my search field (which is currently hidden with display:none) to become visible. However, my current setup is not working as intended. I have created a jsfiddle to illustrate my issue. Al ...

What could be the reason for bootstrap failing to recognize and apply my variables?

Whenever I set the text color to green using this code: @textColor: green; It works perfectly and changes the text color, but when I try to modify grid column width and gutter width with this code: @gridColumnWidth: 10px; @gridGutterWidth: 0px; @flu ...

Revolutionizing the small screen design with a dynamic Bootstrap Responsive Layout that seamlessly adjusts to different screen sizes

In the beginning, I constructed a footer using HTML, CSS, and JS. Eventually, I stumbled upon Bootstrap and decided to recreate the footer using Bootstrap, following a mobile-first design approach for screens smaller than 576px. I had previously designed ...

What is the reason for Chrome not recognizing 'bottom: 0;' as a valid value for an absolutely positioned footer?

It seems like I may be facing a unique issue with my webpage layout in Chrome. The entire page is set up with absolutely positioned elements within a container that is relatively positioned. Although this setup is not typical, it was necessary for incorpor ...

What are the steps for positioning the footer at the bottom of the page?

Need help positioning a footer at the bottom of the page? Using the class fixed-bottom causes the footer to overlap the content when scrolling. <div class="sticky-top"> <qipr-header></qipr-header> <qipr-sidenav>&l ...

What is the method for altering the text color within a disabled input field?

Currently facing difficulty in changing the color of the text within the input field when it's disabled. I'm utilizing Material UI for this purpose. import React from "react"; import { makeStyles } from "@material-ui/core/st ...

inactive toggle being released

I am facing an issue with my two slider menus, where only the right menu holds the active value when clicked. The left menu slides out only when the toggle button is held down, but I need it to slide out when the toggle is simply clicked and not held down. ...

Tips for ensuring the footer always stays at the bottom of the page

I'm having an issue with keeping the footer pinned to the bottom of the page. I haven't applied any specific styles to the footer, just placed it at the end of the content. Everything looks great until there's a page with minimal content, ca ...

Can the CSS be used to conceal the PNG image while still preserving the drop shadow effect?

I recently applied the "Filter: drop-shadow" effect to my png photo and it worked perfectly. However, I am now interested in hiding the actual png image while retaining the shadow effect. My initial attempt involved adjusting the translate and drop-shadow ...

Some pages are experiencing a lack of visibility of Tinymce buttons

Currently, I am utilizing the tinymce plugin for image upload and it is functioning properly on one specific page. However, on a different page, there is a sidebar located on the left side while the main content area is positioned on the right side. The t ...

Exploring ways to repeatedly collapse rows using HTML, CSS, and JavaScript

GOAL: I want to freeze the header, freeze the first column, and be able to collapse rows multiple times. CURRENT PROGRESS: I have achieved freezing the header, first column, but can only collapse rows once. MY CODE SNIPPET: </head> <body> &l ...

Tips for presenting a label and its value on separate lines while also displaying additional nested label-value pairs:

I have a specific request in mind, https://i.sstatic.net/aK5nG.png But the result I am seeing is different, https://i.sstatic.net/ajvhF.png Here's the code snippet, I'm utilizing bulma framework but encountering some challenges... <sectio ...