Dynamic height adjustment for Bootstrap right column

I am struggling to create a layout with a right column using bootstrap. I can't figure out how to achieve the desired arrangement shown in this image. https://i.stack.imgur.com/VaIWD.png

I have attempted various methods but the right column does not adjust its size according to the content in the left column. My project is based on bootstrap 3. Even though I tried the following code, the right column does not match the height of the three columns on the left side. bootply

Any guidance or assistance would be greatly appreciated.

Answer №1

If you want to achieve this layout, you can utilize bootstrap rows/cols along with flexbox. By using Bootstrap 4, which makes use of flex instead of floats for the rows/cols, you can easily create this design.

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet>
<style>
  .flex {
    display: flex;
  }
  .wrap {
    flex-wrap: wrap;
  }
  .red {
    background: red;
  }
  .blue {
    background: blue;
  }
  .yellow {
    background: yellow;
  }
  .green {
    background: green;
  }
</style>
<div class="container">
  <div class="row flex">
    <div class="col-xs-8">
      <div class="row flex wrap">
        <div class="col-xs-6 red">1</div>
        <div class="col-xs-6 yellow">2</div>
        <div class="col-xs-12 blue">3</div>
      </div>
    </div>
    <div class="col-xs-4 green">4</div>
  </div>
</div>

Answer №2

Seems like you're interested in achieving something similar to this:

<div class="row equal-height-cols">
    <div class="col-md-8">
        <div class="row">
            <div class="col-md-6"></div>
            <div class="col-md-6"></div>
            <div class="col-md-12"></div>
        </div>
    </div>
    <div class="col-md-4"></div>
</div>
.equal-height-cols{
  display: flex;
  flex-wrap: wrap;
  justify-content: stretch;
}

You'll need to add some content to visualize the effect, but that code should give you the desired outcome.

*edit: misunderstood the exact intent of the question, updated

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

Guide on validating a dropdown using template-driven forms in Angular 7

Having trouble validating a dropdown select box, possibly due to a CSS issue. Any suggestions on how to fix this validation problem? Check out the demo here: https://stackblitz.com/edit/angular-7-template-driven-form-validation-qxecdm?file=app%2Fapp.compo ...

The Bootstrap table spills over the edges of the container

I'm currently working on a project where I need to create a table with a grey background, but I am facing an issue where the lines from my table are extending past the div container. I even tried placing it inside a form, but that did not resolve the ...

PHP link malfunctioning

Recently, I have been working on adding links to new pages in PHP using Panique for authorization. You can find more information about Panique here. In the views directory, I created a new page called product-des.php. However, when I tried to add a link f ...

Error: Bootstrap 4 Container Size Issue

I am having an issue with the width of my footer when using a Bootstrap 4 "Container". The Container does not cover the entire bottom of the screen as expected. Even changing it to Container-Fluid does not resolve the issue. For reference, here is a JSFid ...

Unable to invoke function on HTML element

Recently, I've ventured into writing jQuery-like functions in Vanilla JS. While my selectors seem to be working fine, I encounter an "is not a function" error when trying to call the append function on an HTML element. var $ = function(){ this.se ...

Localhost causing variations in CSS behavior

I've been working on a website and wanted to share it with someone, so I set up a webserver. However, I've encountered some peculiar behavior when trying to access the site via LAN rather than through my localhost. Firstly, when viewing the site ...

What is the best way to increment the value of an input by any number using JavaScript and HTML?

My code is causing a NaN error, and I'm struggling to identify the root cause. Even providing a specific number in the addnum function did not resolve the issue. <script> var result = document.getElementById("result"); var inputVal = ...

Tips for transforming a menu into a dropdown menu

Is there a way to convert the current menu into a Dropdown menu? Currently, the menu is not collapsing and it keeps opening. Any suggestions on how to achieve this? Here is an example for reference: https://i.stack.imgur.com/2X8jT.png ar ...

How to vertically center a div within a parent div with a fixed position?

I am facing an issue where I have a div positioned on top of another fixed position div, and I am looking for a way to vertically align the first div. Below is the code snippet that I am currently working with: <div class="overlay"> <div id=" ...

What is the best way to use JavaScript to conceal a section of a form div?

After receiving some code from a certain platform and implementing it to hide part of my form div element, I noticed that the element hides and unhides quickly when running in a browser. This rapid hiding and showing behavior occurs when clicking on the bu ...

Creating a Cross Fade Animation effect with the combination of CSS and JavaScript

I've been attempting to create a similar animation using html and css. Below gif shows the desired outcome I am aiming for: https://i.sstatic.net/YsNGy.gif Although I have tried the following code, I have not been able to achieve the desired result ...

"Troubleshooting a CSS Problem in the ADF

I've encountered a serious issue with my ADF Application starting yesterday. Everything was running smoothly until suddenly, I saw this unexpected message in my Jdeveloper Console: < org.apache.myfaces.trinidadinternal.style.util.CSSUtils> < ...

Creating a Circular Design with a Centered Line and Text Above and Below using Qualtrics (HTML/CSS/Java)

My knowledge of creating shapes and using these programming languages is limited. I am currently working on a survey in Qualtrics and I need to insert text into circular shapes. Creating one circle was straightforward, thanks to some helpful discussions ...

Adjusting image size by adding padding to accommodate larger screens using Bootstrap 4

I have incorporated Bootstrap into my server-side web application to resize images for larger screens by adding padding to prevent them from getting too big. However, I'm unsure if this is the best approach. Are there better methods for resizing image ...

Exploring the functionality of transitioning between pages in AngularJS with a single click within a text box

Here is my JavaScript code: var todoModule = angular.module('ToDoModule', ['ngRoute','ngTable']) .config(function($routeProvider) { $routeProvider // route ToDo page .when('/', { ...

Utilizing Vue.js and Webpack to Handle Requests for Multiple Incorrect Resource Links

After utilizing Vue.js single file components to construct a website and appreciating the modular approach, I've encountered an issue. The browser appears to be requesting multiple versions of resources instead of just one URL for each. HeaderBar.vue ...

Intelligent programming and innovative thinking to streamline template diversity

My goal is to create multiple child websites using a base HTML/CSS template. Each child website will have unique color schemes and image variations for elements like <h> tags and background colors. I am searching for ways to easily modify the base th ...

What is the best way to ensure that a div containing lengthy text wraps to the next line as if it were only text overflow?

Is there a way to make a div or span within another div act as text, causing overflow to shift to the next line? I'm unsure of which CSS properties would achieve this effect. I've attempted using overflow-wrap: break-word; word-break: break-al ...

MaxwidthLG in Material UI design

Hi there, I've encountered an issue with Material UI CSS. Even after attempting to override it, the desired effect is still not achieved. My goal is for the entire div to occupy the full page but this is the current result: https://i.stack.imgur.com/b ...

Adding an existing element to the DOM using Javascript/jQuery

I am facing an issue in my DOM where I have an element with two children, a div block and a button. My goal is to add a new copy of the same div block to the parentNode whenever the button is clicked. Currently, I am using the following code in the button ...