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

Parse JSON data, iterate through dictionaries, and convert into markup using Python

I'm working with a JSON file that contains information about different people: { "PersonA": { "Name": "Woman A", "Age": 23, "Info": "Likes cats ..." }, "PersonB": { "Name": "Man B", "Age": 32, ...

Incorporate a smooth infinite scroll feature in a CSS carousel that seamlessly loops without

Looking for a solution to the carousel jerk issue when it reaches the end of the loop? Is there a way to seamlessly loop start without any noticeable interruptions? Here is the code in question. Avoiding the use of JavaScript, is there a method to achieve ...

Is it possible to move between textboxes using arrow keys in HTML?

Is there a way to navigate through textboxes using arrow keys in HTML without relying on jQuery? Possibly utilizing JavaScript, HTML, CSS, or another method? Thank you for your help! <body> <form> <input type="text"&g ...

Positioning JQuery sliders

I've been working on a jQuery slider for my header, but I'm encountering an issue where the previous image drops down to the next container instead of staying in place and transitioning smoothly. It seems like there might be an error in my HTML/C ...

Tips for interpreting Json data received from a WCF service in HTML with the help of AJAX technology?

Can anyone assist me with retrieving data details from a JSON model? I am utilizing a WCF service that returns JSON data and it works fine as I have tested it using WebClient. However, I am having trouble displaying the data on my HTML site. Despite trying ...

Invoke a function within the <img> tag to specify the source path

I have been attempting to achieve something similar to the following: <img id="icon" class="cercle icon" src="getIcon({{item.status}})" alt=""> This is my function: getIcon(status){ switch (status) { case 'Ongoing': ret ...

HTML - Link to enable automatic printing of the page

Assignment: Develop a hyperlink (HTML <a> tag) that triggers the printing of the webpage without the user manually pressing CTRL + P. My search for information on this topic has not yielded a definitive answer. Some sources suggest using JavaScript ...

Identifying when a user is idle on the browser

My current project involves developing an internal business application that requires tracking the time spent by users on a specific task. While users may access additional pages or documents for information while filling out a form, accurately monitoring ...

Modify the CSS class by adding attributes dynamically instead of directly to the element

I encountered a situation where I needed to apply a css property to a class rather than an element. For example: $('.class_with_css').css({display:'none'}); This code would add the style "display:none" to all elements with the cl ...

Having trouble aligning the image to the center

After researching and trying various solutions suggested for aligning an image, I am still unable to get it to align as desired. Here is the HTML code snippet: <section> <img class="seattle" src="img/Seattle Pier.jpg" alt="Seattle docks"> ...

Using Python with Selenium, attempt to click on a button designated as type="button"

I've been trying to click on a button in this Airbnb listing but none of the codes I tried seem to work. Here is one example of the HTML code: <li data-id="page-2" class="_1eqazlr"> <button type="button" class="_1ip5u88" aria-label="Page 2 ...

What is the best way to interpret numerous rows of Form elements simultaneously?

What is the most efficient way to name form elements across rows for easy conversion into JSON format? Considering HTML does not have built-in Array support, what alternative method should be used? In each row, there are 2 text fields and 1 select dropdow ...

Gap in footer spacing on Internet Explorer is significantly large

The layout of the page is split into two main sections: A large header that takes up 100% of the browser height The main content area and footer When viewing the page in a browser, only one of these sections will be visible. The following code works wel ...

What is the best way to preload all videos on my website and across different pages?

I specialize in creating video websites using HTML5 with the <video> tag. On my personal computer, the website transitions (fadeIn and fadeOut) smoothly. However, on my server, each page seems to take too long to load because the videos start preloa ...

Issue with CSS background scaling bug

Is it possible to make the cloud background scale within the box? The current issue can be viewed here: I have tried various methods to resolve the problem where the background scales even beyond the limited box. However, I could not identify the solutio ...

Creating an Unordered List in GWT that Includes List Items

I've hit a roadblock while trying to create a css-driven menu in GWT. The menu should be rendered exactly like this: <div class="topbar"> <div class="container fixed"> <h3> <a href="" class="logo">test& ...

Unable to implement a design on a button during its click event

I successfully implemented a dynamic button in HTML5 and Javascript. The button has a click event assigned to it, so when clicked, its content and background color are supposed to change. However, while the content changes correctly, the background color d ...

Revolutionizing Communication with Flash Websockets

Here are a couple of connected queries: I've read that non-HTML5 browsers can utilize Flash to connect to websockets. https://github.com/gimite/web-socket-js 1. Is there an actual implementation of websockets for Flash within Flash itself? 2. If I ...

JavaScript will continue to process the submit to the server even after validation has been completed

My current challenge involves implementing form validation using JavaScript. The goal is to prevent the form from being sent to the server if any errors are found. I have made sure that my JavaScript function returns false in case of an error, like so: ...

Tips for properly aligning numbered lists in text documents

My issue involves designing an order list paragraph where I also need a paragraph in the middle of the ordered list numbers. The first paragraph is displaying correctly, but the second and third paragraphs are only appearing as single lines, so I adjuste ...