Creating an image that scales to full width within a Bootstrap column after switching to mobile view

I am having trouble getting the image on the right to expand to full width when the screen size is reduced, transitioning it to mobile view. Is there a Bootstrap class that works similarly to "img-fluid", but displays the image in full width below the text in the Bootstrap grid system?

<div class="row">
<div class="col-md-6 d-flex">
<div class="align-self-center">
<p class="lead font-weight-bold">sometext</p>
</div>
</div>
<div class="col-sm-6">
  <img class="img-fluid" src="someimage.jpg">
</div>
</div>

Check out my fiddle: http://jsfiddle.net/x1hphsvb/2220/. Lower the width of the display window to see what I mean - the image drops below the text and only fills half of the div, but I want it to fill the entire space and behave as it does before the transition.

Answer №1

Ensure that both columns share the same breakpoint (i.e., md/sm) to achieve full-width alignment simultaneously...


   <div class="row">
     <div class="col-md-6 d-flex">
      <div class="align-self-center">
       <p class="lead font-weight-bold">sometext</p>
      </div>
     </div>
     <div class="col-md-6">
      <img class="img-fluid" src="someimage.jpg">
     </div>
   </div>

http://jsfiddle.net/dwnu5zjq/

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

Tips for adjusting the position of the sidebar with a grid system

I am working with a traditional design: #divleft{ float:left; } #sidebar{ float:right; } @media screen and (max-width: 900px) { #divleft, #sidebar{ float:none; } divleft and sidebar are elements within panelb; Now, I am exploring ...

How to effectively delete the class from a navigation list item

Looking for some inspiration? Check out the basic visuals for this question here. But let me break it down for you. This snippet shows the HTML & CSS behind a tabbed-carousel, with a condensed version for clarity: <style> #myCarousel-100 . ...

Tips for aligning text and image in the center of a div with a specific width:

I'm having a hard time figuring this out for some reason. I need to center both text and an image on the same line within a div that has a 100% width. Check out this jsfiddle link for reference: http://jsfiddle.net/JnbeJ/ ...

What could be causing my Bootstrap (3) grid to not display responsively?

It seems like there may be a simple oversight in my code, as I'm unable to make my Bootstrap grid responsive. I have successfully passed item data through Node and am able to display a grid of item thumbnails with captions in rows of 4. However, when ...

Issue displaying content in a two-column setup on Chrome and Mozilla browsers due to ASP problem

I've encountered an issue with a footer appearing incorrectly in Chrome and Mozilla browsers when using a 2-column layout, although it displays fine in IE8. Currently, I'm coding in asp with css includes to render the footer. Here's the CSS ...

Tips for fixing CORS error when working with the fetch API

I'm having trouble retrieving data from the metaweather.com API using JavaScript's fetch function. I attempted to include before the API URL, but it has not resolved the issue. I followed a video tutorial on how to fetch data, but I'm stil ...

Sweetalert not functioning properly when deleting records from Datatable

I am currently working on a CRM script and encountering an issue. The customers are stored in a data table, and I am trying to implement a delete function with confirmation from both the database and the data table. I have written some code and placed it w ...

Using PHP foreach loop to create bootstrap 4 cards

I am attempting to showcase all of my shop items on my webpage using Bootstrap 4 cards. I want them to be displayed in a grid format, three wide and however many deep (I may consider adding pagination later). Currently, I have a PHP foreach loop that succ ...

Tips for retrieving the option text value following an onchange event in AngularJS

Whenever I change the selection in my dropdown menu for 'Cities', the alert is displaying the value of the previous selection instead of the current one. For example, if I select a state and then switch to Cities, the alert shows the text related ...

Using jQuery to access the value of the CSS property "margin-left"

I created a JavaScript game with moving divs that have different transition times. The game includes a function that is called every 1/100 seconds, which checks the position of the divs using: $("class1").css("margin-left") Here's the strange part: ...

Innovative Functions of HTML5 LocalStorage for JavaScript and TypeScript Operations

Step-by-Step Guide: Determine if your browser supports the use of localStorage Check if localStorage has any stored items Find out how much space is available in your localStorage Get the maximum storage capacity of localStorage View the amount of space ...

Setting up the CSS loader in a Vue.js project using webpack

I am currently working on a new vue-cli project and have successfully installed the Pure.CSS framework using npm install purecss --save. However, I am struggling to seamlessly integrate, import, or load the css framework into my project. I am unsure of whe ...

Tips for eliminating the gap between Bootstrap 4 columns

Is there a way to eliminate the spacing between Bootstrap columns? I have three columns set up using Bootstrap but no matter what I do, I can't seem to get rid of the space between them. <!doctype html> <html lang="en> <head> ...

Tips for Utilizing CSS Overflow: Hidden to Prevent the Parent Container from Expanding

I have a fixed width column and a fluid column. In the fluid column, I want to display a string with nowrap so that it does not overflow the container. Here is an illustration of how I want the text to appear: --------------------------------------------- ...

When the ID and anchor link within a URL fail to scroll to the specified anchor location

I'm trying to add an id to a URL and scroll to an anchor link <a name="tags" id='tags'></a> <a href="edit.php?id=382#tags">GO</a> I have also attempted the following: <a href="edit.php?id=382&#tags">GO& ...

Is there a special Angular technique to ensure a div remains scrolled to the bottom of its items?

In this interactive demonstration, you can see how jQuery can be utilized to create a terminal-like feature. This functionality ensures that as new items are added to a scrollable div, the scroll automatically locks at the bottom. Pay close attention to l ...

Using AJAX to dynamically load Javascript

I came across this interesting code snippet: <script type="text/javascript" language="javascript"> $(function(){ $(window).hashchange( function(){ window.scrollTo(0,0); var hash = location.hash; if (hash == "") { hash="#main"; } ...

Retrieve data from an HTML form within an Angular 2 ag-grid component

I'm facing a challenge with incorporating form values from a modal into an ag-grid array in my HTML file. I'm unsure of the process to achieve this. Below is an excerpt from my file.html: <template #addTrainContent let-c="close" let-d="dismi ...

Using CSS, the ability to scroll to the top of a page is restricted when an inner div expands to the top while using flex

While following a tutorial on YouTube, I encountered an issue where my expanding content, when exceeding the size of the window in a small screen view, prevented me from scrolling to the top. Interestingly, I could scroll to the bottom and back up to that ...

Process only the $_POST variables that have a specific string prefix

I am currently working on a form that will be handling numerous elements sent via $_POST. A significant portion of these elements, which are too numerous to list individually, have a consistent naming pattern: $_POST['city_1'] $_POST['city_ ...