Aligning elements in the Bootstrap 3 Grid

Hey there, fellow brainiacs!

I'm in need of some assistance with aligning my bootstrap grid. The issue I'm facing is that it doesn't stack properly when in responsive mode. I would really appreciate some guidance on how to make it fold and stack correctly for a neat display on mobile devices.

If someone could help me with the structure without any styling, I would be extremely grateful, and I'll take care of the styling myself.

I have provided two example images: one showing the full view and the other displaying how it should stack or fold.

https://i.sstatic.net/hKRSt.png https://i.sstatic.net/CerB2.png

This is my code

div.parent { 
    border  : solid black 1px;
    display : table;
    padding : 5px; 
    width   : 100%;
  /* you can change/remove margin */
    margin   :5px 0; 
  }
div.text { 
    vertical-align : middle;
    display        : table-cell;
    text-align     : justify;
}
div.parent .img {
    vertical-align   : middle;
    display          : table-cell;
    padding-right    : 5px;
    width            : 100px; /* you can change width */
}
div.img img { 
    width           : 100%;
    /* you can change height */
    vertical-align   : middle;
}


.my_planHeader {
    text-align: center;
    color: white;
    padding-top:0.2em;
    padding-bottom:0.2em;
}
.my_planTitle {
    font-size:1em;
color: #000;
}
.my_subTitle {
    font-size:0.80em;
color: #A64470 ;
color: #000;
}
.my_planPrice {
    font-size:0.80em;
    font-weight: bold;
color: #C0BBBB;    
}
.my_disc {
    font-size:1.4em;
    font-weight: bold; 
color: #C0BBBB;    
}
.my_planDuration {
    margin-top: -0.6em;
}

@media (max-width: 768px) {
    .my_planTitle {
        font-size:small;
    }    
}


 

/* --- TRANSFERS --------------------------- */

.my_plan1 {
    background: rgb(224,234,242);
}

.my_planHeader.my_plan1 a {
    background: rgb(72, 109, 139);
    color:white;
}

.my_planHeader.my_plan1 {
    background: #FEF6ED;
    border-bottom: thick solid #FEEAD2;
}



/* --- FEE --------------------------- */
.my_plan2 {
    background: rgb(230,235,218);
}

.my_planHeader.my_plan2 a {
    background: rgb(108, 131, 62);
    color:white;
}

.my_planHeader.my_plan2 {
    background: #FCDFD1;
    border-bottom: thick solid #FEF1EC;
}

/* --- APR --------------------------- */
.my_plan3 {
    background: rgb(254,235,212);
}

.my_planHeader.my_plan3 a {
    background: rgb(199, 127, 40);
    color:white;
}

.my_planHeader.my_plan3 {
    background: #F7D5DF;
    border-bottom: thick solid #FBEDF1;
}

/* --- OVER --------------------------- */


.my_plan4 {
    background: rgb(254,235,212);
}

.my_planHeader.my_plan4 a {
    background: rgb(199, 127, 40);
    color:white;
}

.my_planHeader.my_plan4 {
    background: #EAD3DD;
    border-bottom: thick solid #F7D5DF;
}
/* --- OVER --------------------------- */


.my_plan5 {
    background: rgb(254,235,212);
}

.my_planHeader.my_plan5 a {
    background: rgb(199, 127, 40);
    color:white;
}

.my_planHeader.my_plan5 {
    background: #F8F8F8;
    border-bottom: thick solid #C0BBBB;
}
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="css/scrolling-nav.css" rel="stylesheet">



<div class="container">
<div class="col-md-12 col-lg-12 col-sm-12 col-xs-12">
<div class="row">     



<div class="parent">
<div class="img">
<div class="col-lg-12 ">
<img src="http://www.placehold.it/90x90" class="img-responsive" alt="Some picture" width="150" height="150">
</div></div>
    
    <div class="text">
    <div class="col-lg-3 my_planHeader my_plan1">
    <div class="my_subTitle">Balance Transfers</div>
    <div class="my_planTitle">0% for 24 months</div>
    </div>
    
    <div class="col-lg-3 my_planHeader my_plan2">
    <div class="my_subTitle">Balance Transfers</div>
    <div class="my_planTitle">0% for 24 months</div>
    </div>
    
    <div class="col-lg-3 my_planHeader my_plan3">
    <div class="my_subTitle">Balance Transfers</div>
    <div class="my_planTitle">0% for 24 months</div>
    </div>
    
    <div class="col-lg-3 my_planHeader my_plan1">
    <div class="my_subTitle">Balance Transfers</div>
    <div class="my_planTitle">0% for 24 months</div>
    </div>
    
    <div class="col-lg-12 ">
    <p>Free aqua credit checker. Start with a credit limit of £250-£1,200 and you    could get an increase on your 4th statement.
    Once the 0% deal ends the balance transfer rate will be 34.95% p.a. variable with a 3% fee.</p>
    </div>
    
    <div class="col-lg-12 my_planHeader my_plan3">
    <div class="my_subTitle">Balance Transfers</div>
    <div class="my_planTitle">0% for 24 months</div>
    </div>

</div>
</div>
</div>  
</div>
</div>

Here's how it currently looks on mobile devices

Answer №1

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<div class="col-sm-12 col-md-6 col-lg-6">

<div class="row">
  <div class="col-sm"><img src="http://www.placehold.it/90x90" class="img-responsive" alt="Some picture" width="100%" height="150"></div>
  <div class="col-sm my_planHeader my_plan1"><div class="lukeStuff">Balance Transfers</div><div class="my_planTitle">0% for 24 months</div></div>
  <div class="col-sm my_planHeader my_plan2"><div class="lukeStuff">Balance Transfers</div><div class="my_planTitle">0% for 24 months</div></div>
  <div class="col-sm my_planHeader my_plan3"><div class="lukeStuff">Balance Transfers</div><div class="my_planTitle">0% for 24 months</div></div>
</div>
<div class="col-sm-12 col-md-12 col-lg-12"><p>Free aqua credit checker. Start with a credit limit of £250-£1,200 and you    could get an increase on your 4th statement.Once the 0% deal ends the balance transfer rate will be 34.95% p.a. variable with a 3% fee.</p></div>
<div class="col-sm-12 col-md-12 col-lg-12 my_planHeader my_plan3"><div class="lukeStuff">Balance Transfers</div><div class="my_planTitle">0% for 24 months</div></div>
</div>

    div.parent { 
    border  : solid black 1px;
    display : table;
    padding : 5px; 
    width   : 100%;
  /* you can change/remove margin */
    margin   :5px 0; 
  }
div.text { 
    vertical-align : middle;
    display        : table-cell;
    text-align     : justify;
}
div.parent .img {
    vertical-align   : middle;
    display          : table-cell;
    padding-right    : 5px;
    width            : 100px; /* you can change width */
}
div.img img { 
    width           : 100%;
    /* you can change height */
    vertical-align   : middle;
}


.my_planHeader {
    text-align: center;
    color: white;
    padding-top:0.2em;
    padding-bottom:0.2em;
}
.my_planTitle {
    font-size:1em;
color: #000;
}
.my_subTitle {
    font-size:0.80em;
color: #A64470 ;
color: #000;
}
.my_planPrice {
    font-size:0.80em;
    font-weight: bold;
color: #C0BBBB;    
}
.my_disc {
    font-size:1.4em;
    font-weight: bold; 
color: #C0BBBB;    
}
.my_planDuration {
    margin-top: -0.6em;
}

@media (max-width: 768px) {
    .my_planTitle {
        font-size:small;
    }    
}


 

/* --- TRANSFERS --------------------------- */

.my_plan1 {
    background: rgb(224,234,242);
}

.my_planHeader.my_plan1 a {
    background: rgb(72, 109, 139);
    color:white;
}

.my_planHeader.my_plan1 {
    background: #FEF6ED;
    border-bottom: thick solid #FEEAD2;
}



/* --- FEE --------------------------- */
.my_plan2 {
    background: rgb(230,235,218);
}

.my_planHeader.my_plan2 a {
    background: rgb(108, 131, 62);
    color:white;
}

.my_planHeader.my_plan2 {
    background: #FCDFD1;
    border-bottom: thick solid #FEF1EC;
}

/* --- APR --------------------------- */
.my_plan3 {
    background: rgb(254,235,212);
}

.my_planHeader.my_plan3 a {
    background: rgb(199, 127, 40);
    color:white;
}

.my_planHeader.my_plan3 {
    background: #F7D5DF;
    border-bottom: thick solid #FBEDF1;
}

/* --- OVER --------------------------- */


.my_plan4 {
    background: rgb(254,235,212);
}

.my_planHeader.my_plan4 a {
    background: rgb(199, 127, 40);
    color:white;
}

.my_planHeader.my_plan4 {
    background: #EAD3DD;
    border-bottom: thick solid #F7D5DF;
}
/* --- OVER --------------------------- */


.my_plan5 {
    background: rgb(254,235,212);
}

.my_planHeader.my_plan5 a {
    background: rgb(199, 127, 40);
    color:white;
}

.my_planHeader.my_plan5 {
    background: #F8F8F8;
    border-bottom: thick solid #C0BBBB;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<div class="col-sm-12 col-md-6 col-lg-6">
    
<div class="row">
  <div class="col-sm"><img src="http://www.placehold.it/90x90" class="img-responsive" alt="Some picture" width="100%" height="150"></div>
  <div class="col-sm my_planHeader my_plan1"><div class="lukeStuff">Balance Transfers</div><div class="my_planTitle">0% for 24 months</div></div>
  <div class="col-sm my_planHeader my_plan2"><div class="lukeStuff">Balance Transfers</div><div class="my_planTitle">0% for 24 months</div></div>
  <div class="col-sm my_planHeader my_plan3"><div class="lukeStuff">Balance Transfers</div><div class="my_planTitle">0% for 24 months</div></div>
</div>
<div class="col-sm-12 col-md-12 col-lg-12"><p>Free aqua credit checker. Start with a credit limit of £250-£1,200 and you    could get an increase on your 4th statement.Once the 0% deal ends the balance transfer rate will be 34.95% p.a. variable with a 3% fee.</p></div>
<div class="col-sm-12 col-md-12 col-lg-12 my_planHeader my_plan3"><div class="lukeStuff">Balance Transfers</div><div class="my_planTitle">0% for 24 months</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

Error: The function m.easing[this.easing] is not defined

I have been working on creating anchor link scrolling and tooltip display using bootstrap, but I am encountering an issue. $(window).scroll(function(){ if ($(window).scrollTop() >= 100) { $('#header').addClass('fixed'); ...

What is the best way to indicate line breaks in HTML text while still allowing for easy copy and paste?

I have a form that shows a table filled with email addresses, and I want to indicate to the browser that the email address can wrap before the @; for example, <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b3824262e2724252c2e2 ...

Explore three stylish ways to showcase dynamic JavaScript content using CSS

Objective: For Value 1, the CSS class should be badge-primary For Value 2, the CSS class should be badge-secondary For all other values, use the CSS class badge-danger This functionality is implemented in the handleChange function. Issue: Current ...

Ways to adjust the font size of mat-menu-item?

I came across a query regarding this matter on another platform: How can the font size of mat-menu-item be changed to small in Angular? Unfortunately, the solution provided did not work for me. I attempted to implement the suggested code in my Angular a ...

Guide to adding an additional border within a div element

In my HTML document, I've created a div element with a border: .box {border: 1px solid black; width: 100%; height: 200px} <div class="box"></div> Now, I'm looking to enhance this div by adding a second vertical line that will divid ...

Modify anchor link color in a one-page website by using Jquery to detect scroll position changes when reaching different page sections

Each if statement contains specific numbers to change the text color of the visited/current/active anchor link. The height of the page is dependent on its width. How can this be resolved? Apologies if my explanation is confusing, English isn't my stro ...

The Bootstrap Carousel fails to function properly when applied to elements that are dynamically generated through JavaScript

I'm attempting to design a feed similar to LinkedIn on social media where each div acts as a carousel displaying images just like a social media feed. Using JavaScript, I dynamically generate the following element with images for the carousel: &l ...

Adjust the height of the element to match the parent's height

I am working on a design with a structure like this: <section> <h3>Title:</h3> <p>Content that may span multiple lines.</p> </section> section { background: #5E5E5E; overflow:hidden; } h3 { backgro ...

Guide on transforming the popup hover state into the active state in vue.js through a click event

My code currently includes a popup menu that shows up when I hover over the icon. However, I need to adjust it so that the popup changes its state from hover to active. Intended behavior: When I click the icon, the popup should appear and then disappear w ...

Positioning divs at the top

My goal is to design a simple layout with two divs positioned side by side, but they have different heights. I expected the smaller div to align at the top, but it's showing up at the bottom instead. Is this normal behavior within the page flow? < ...

Searching for a specific element using a CSS selector

Looking for a way to find an element using a CSS selector in Chrome, I followed these steps: Right-click on the object Select "inspect" Right-click on the highlighted area in Chrome developer tools Choose "copy" Click on "copy selector" This is the cod ...

The challenge of handling overflow in IE9

I'm encountering an issue specifically in IE9 where a child div is not respecting the overflow:hidden property of its container div. The outlined blue div in the image represents the container with overflow:hidden. The goal is for the images to stay w ...

Tips for modifying padding in HTML and CSS?

I'm struggling to add padding around the image without affecting the mobile view. Here's what I've tried: float-right or padding-right:250px; // but nothing happens and it affects the mobile view. Please review my code: .fontProfile ...

Instructions for making all the cells in a Bootstrap 3 row the same height

I'm currently working on a grid of cards that can be flipped and have varying content. I'm attempting to make the height of cards with less content equal to the card with the most content. However, regardless of where I use height:100%, the small ...

Designating a specific character set for style sheets

Within my CSS stylesheets, you may come across code that resembles the following snippet: #nav > li::after { content: " ➻"; } It's worth noting that ➻ is not an ASCII character, which can make it risky to use in a file without explicitly ...

How can I fetch dependent data via AJAX within a multi-select dropdown using Bootstrap and PHP?

Would you like to know how to implement a multi-select dependent drop-down using Bootstrap Multi-Select? https://i.sstatic.net/ISlqn.png If a state is selected, do you want the corresponding cities to populate the city drop-down box? Below is my AJAX co ...

CSS style for formatting content attribute

I have a list in numerical order where I utilize the counter feature within the content. Query: Is there a way to change the color of the numbers only (e.g. 1.2, 1.3, ...) to red using CSS without making any changes to the HTML code? Note: Only seeking ...

Enhance your code's readability with the Code Beautifier Tool for improved clarity

I recently came across a website where they intricately formatted their code with line numbers and highlighting, but I couldn't find any information on how to achieve this effect. I want my code to look just like that, can anyone help me out? Website ...

Create a sleek and uniform design with Bootstrap by setting up three columns that maintain the same height

I am attempting to design a 3 column div that maintains equal height for all responsive rows, each containing an ICON and information. <div class="container"> <div class="row row-eq-height"> <div class="col c ...

Steps to eliminate the quotation marks

$movieTitle = $movieArray['title']; echo $movieTitle; After echoing out, the value of the string is "Sherlock". Is there a way to remove the quotation marks from the string and display it as Sherlock? ...