The Bootstrap 4 grid appears to be malfunctioning as the columns are not displaying next to each other as expected

I've implemented the code below in an attempt to achieve the desired layout shown in the image, but instead, I'm getting a different outcome. Can someone help me figure out what I might be doing wrong with the Boostrap 4 grid system?

I'm confused as to why the columns that should be side-by-side are displaying on top of each other rather than next to each other.

Even after trying to set the padding and margin to zero, the issue persists.

<div class="container">
  <div class="row">
    <div class="col-md-4 col-xs-12">
      1
    </div>
    <div class="col-md-8 col-xs-12">
      <div class="col-md-12">
        <div class="col-md-2">
          2.1
        </div>
        <div class="col-md-10">
          <div class="col-md-12">
            2.21
          </div>
          <div class="col-md-12">
            2.22
          </div>
        </div>
      </div>
      <div class="col-md-12">
        <div class="col-md-2">
          3.1
        </div>
        <div class="col-md-10">
          <div class="col-md-12">
            3.21
          </div>
          <div class="col-md-12">
            3.22
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

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

Answer №2

Give this a shot: Remember to exclude the third Column.


<div class="container">
 <div class="row">
    <div class="col-md-4 col-xs-12">
      1
    </div>
    <div class="col-md-8 col-xs-12">
      <div class="col-md-12">
        <div class="col-md-2">
          2.1
        </div>
        <div class="col-md-10">
          <div class="col-md-12">
            2.21
          </div>
          <div class="col-md-12">
            2.22
          </div>
        </div>
      </div>
      </div>
    <div class="col-md-4 col-xs-12">
      <div class="col-md-12">
        <div class="col-md-2">
          3.1
        </div>
        <div class="col-md-10">
          <div class="col-md-12">
            3.21
          </div>
          <div class="col-md-12">
            3.22
          </div>
        </div>
      </div>
    </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

The HTML content I created is too large for the screen and is extending beyond its borders

The navigation bar and footer on my HTML page adjust themselves according to the screen width, but the main content is not adjusting properly. I tried using a media query for mobile resolution (517px), but when I tested it on a PC with a smaller screen wi ...

Active Arrow Link

I'm currently working on customizing the appearance of my WordPress site's categories sidebar by adding an arrow to the left side of the active link. After tweaking the CSS to achieve the desired behavior and making some color adjustments for te ...

Adjust the div container to wrap underneath the image if the webpage width decreases

Hello there, I am currently in the process of creating my own portfolio. I have a brief introduction that I would like to display next to an image of myself, with the image positioned on the right side. I have a div called "container" which contains anoth ...

Avoid cascading of the 'display' property in JavaScript styling to prevent inheritance

Is there a way in Javascript to toggle the visibility of a larger portion of HTML without affecting inner display properties with display: <value>? Despite setting an outer display property using Javascript, the inner display properties are also alt ...

Issue with Bootstrap small column vertical alignment not functioning as expected

I am working on a bootstrap layout with two columns. One column contains multiple elements and text, making it quite long, while the other column only has an image. I am trying to center this image vertically within the left column of content. Here is the ...

display the information stored within the sports attribute using React

I am attempting to display the values stored in the sports property. So, I inserted a console log within the sports property. However, an error is being thrown: Syntax error: C:/codebase/src/containers/sports.js: Unexpected token, expec ...

EJS causing issues with Bootstrap tooltip functionality

I have implemented tooltips by adding the necessary script to my ejs file and including CDN links for Bootstrap, Popper, and jQuery. However, I am still facing issues with invoking the tooltips. Is there something crucial that I might be overlooking or a ...

Wordpress easily adjusts post alignments for a seamless display

Can anyone help me figure out how to properly align posts in Wordpress to match the example image attached? I've tried using inline-block or float with CSS/HTML, but the posts are not aligning correctly. I'm unsure of what this method is called s ...

Issue with Google Chrome not showing stylesheets on Windows 7

Recently, I've been facing an issue with CSS layers on my website while using Google Chrome. Despite following the code accurately, my browser fails to display the expected result. To troubleshoot, I even copied and pasted code from a reliable source ...

What is the best approach for creating HTML and CSS layouts: focusing on margin/padding or positioning?

When it comes to designing with HTML5 and CSS3, is it more beneficial to rely on margin and padding for layouts or should positioning be the main focus? I have always combined both methods to achieve desired outcomes but there are examples where each appr ...

A Step-by-Step Guide to Setting Up a Scoreboard for Your Rock Paper Scissors Game

I'm new to JavaScript and I want to create a rock, paper, scissors game from scratch. My Game Plan: Once the user clicks on an option (rock, paper, scissors), the game will display their score and the computer's score along with the result of t ...

What is the process for adjusting the color of a div?

Is there a way to adjust the background color of a div when hovering over another div in HTML? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.or ...

Tips on effortlessly updating the URL of your website

Despite seeing the question asked multiple times, I still find myself struggling to understand how to modify a URL or create a new HTML page that seamlessly integrates into a website without redirecting users. I am curious about achieving the functionalit ...

Addressing see-through box styling in CSS

When working on a website using HTML and CSS, I encountered an issue with a transparent box. All elements within this box are also transparent, but I want them to be solid without any opacity. How can I resolve this? .parent { display: inline-block; ...

The class is failing to be applied to the parent div that holds an id starting with the letter x

I have been attempting to assign a class to the parent container when the child element has the 'hidden' class. If not, then a different class should be added. function tagMissions() { if ($('span[id^="mission_participant_new"]').h ...

Adjust Element Width Based on Scroll Position

I'm attempting to achieve a similar effect as seen here: (if it doesn't work in Chrome, try using IE). This is the progress I've made so far: http://jsfiddle.net/yuvalsab/op9sg2L2/ HTML <div class="transition_wrapper"> <div ...

Customizing Mouse Pointers in CSS

My goal is to customize the click pointer on a website using CSS. I have successfully changed the default cursor, but now I am seeking help in changing different 'versions' of the cursor. Here's my current attempt at customizing the pointe ...

Glass-pane or angular/HTML overlay on a designated element

Is there a way to create a glass-pane effect, like an hourglass symbol on a semi-transparent layer, within the boundaries of an HTML element E? The goal is to have the glass-pane only overlap the area within E's boundaries. When the glass-pane is ac ...

Tips for creating a CSS triangle background on a div without relying on borders or images

I have experience creating triangles using CSS borders and images, but this time I want to achieve it using background color. Here is the image of the desired outcome: https://i.stack.imgur.com/qP3yt.jpg If anyone can assist me with this, it would be gre ...

The content in the flex box item with horizontal scroll is overflowing beyond its boundaries

I am working with a flex box container that contains two child elements: a left side and a right side. I want the right side item to have a horizontal scrollbar in order to fit its content. .container { display: flex; overflow: hidden; height: 300 ...