"Discrepancy in column display across various resolutions in Bootstrap 5.3 causing issues

My goal is to have 4 divs that change in width at different resolutions, but for some reason it's not working.

I am looking for:

  • When the resolution is ≥992px, the divs should be in the same line (3 columns)
  • When the resolution is ≥768px, the divs should be in 2 lines - the first three divs on the first line with 4 columns and the last div on the second line with 12 columns
  • For resolutions less than that, the divs should be in 2 lines - the first and second with 6 columns each and the third and fourth with the same

However, I am facing an issue with the last resolution, <768px. It seems like only the col-lg and col-md resolutions are being applied...

If I remove the col-md resolution, then the col-6 resolution starts working! I'm confused and unsure how to proceed.

<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="583a37372c2b2c2a3928186d766b">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet">

<body class="container-fluid">
<div class="row">
    <div class="col-6 col-sm-6 col-md-4 col-lg-3 bg-danger">Div1 respon</div>
    <div class="col-6 col-sm-6 col-md-4 col-lg-3 bg-primary">Div2 respon</div>
    <div class="col-6 col-sm-6 col-md-4 col-lg-3 bg-success">Div3 respon</div>
    <div class="col-6 col-sm-6 col-md-4 col-lg-3 bg-secondary">Div4 respon</div>
</div>
</body>

Answer №1

Just a little off! To properly format the 4th element, make sure to use col-md-12. Also, you can remove the sm breakpoints since they duplicate your default values.

<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email_" data-cfemail="56343939222522243726166378657865">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet">

<body class="container-fluid">
<div class="row">
    <div class="col-6 col-md-4 col-lg-3 bg-danger">Div1 respon</div>
    <div class="col-6 col-md-4 col-lg-3 bg-primary">Div2 respon</div>
    <div class="col-6 col-md-4 col-lg-3 bg-success">Div3 respon</div>
    <div class="col-6 col-md-12 col-lg-3 bg-secondary">Div4 respon</div>
</div>
</body>

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

Arrangement of words within a silhouette

I am looking to insert text into a specific shape. The parameters I have include the font, text width, text height, and margin of the text. The text is positioned within a shape with coordinates x and y. Here is an example image: https://i.sstatic.net/Mpq ...

Searching and categorizing information within a table using jQuery

Can someone help me with merging my html and jquery code for type and filter table data, as well as tag data in the same input box? I have the code for both functionalities separately (http://jsfiddle.net/tutorialdrive/YM488/), but I want to combine them. ...

Vue's emission system, accessed through this.$emits, unexpectedly ceases functioning mid-function call

Within my Vue frontend, I have a function designed to emit updates to the parent component before and after sending a request to the server. The function in question is as follows: saveUpdates: async function () { const component = { doc: ...

Square Power Box

I have been attempting to create two equal sections, one displaying an image and the other showing text, both maintaining a square shape with identical width and height. I am using the Avada theme on Wordpress along with Element Builder and custom CSS to a ...

Positioning Problems with Popups

I have been facing an issue with the positioning of a popup in my trivia game. Despite trying multiple solutions, I have not been able to achieve consistency. Here is a snippet of the HTML code: <div class="logo"> <img src="css/rio-40.png"/& ...

Issues may arise when attempting to parse AJAX responses using Javascript/JQuery AJAX

There are many posts on this topic, but I am having trouble finding the specific information I need. Here is where I am struggling: I have an AJAX request for an ID and an integer (which will be used as a margin to apply on the DOM later). This is the re ...

Converting dates from JavaScript to Central Daylight Time (CDT) using the new

I have a function below that is used to format a date from an API Response. However, when the date "2021-10-02" is received in the response, the new Date() function converts it to Mon Oct 01 2021 19:00:00 GMT-0500 (Central Daylight Time), which is one da ...

Is there a way to place a clickable icon above images in a flexbox grid, specifically in the bottom right corner?

Can someone help me place an icon like this over my flexbox image grid in my project? I want the icon to be clickable so that when it's clicked, the image will pop up large. Any assistance would be greatly appreciated! Thank you! See below for the co ...

Large header picture

Instead of tiptoeing around the issue, let me just be blunt and ask: I'm curious about how they created this image header. Even after removing all javascript code and css using Chrome's property inspector, the image continued to stretch. The sty ...

Adjust the size of the password input characters without changing the appearance of the placeholder

Is there a way to enlarge the font size of an HTML password input without changing the placeholder text as well? Specifically, I am looking to increase the size of the password symbols (bullets). I attempted to adjust the font-size property of input[type= ...

When a child of a flex-item does not inherit the height of its parent in a flex container with a column direction and flex-basis set

Wow, that title was long! Let me try to clarify my confusion: So I have a flex-container with 2 flex items. <!-- HTML --> <div class="container"> <div class="item-1"> <div class="child-of-item-1"></div> < ...

Is there a way to update page content without having to refresh the entire page?

My goal is to refresh specific content on a page without having to reload the entire page using JavaScript or jQuery. Since my project is built in PHP and JavaScript, I encountered this issue. Note : I want the page content to refresh when a user performs ...

What is the best way to highlight Navbar links when reaching a specific section?

When designing my website, I encountered an issue with the active navigation link style. It successfully changes when clicked and scrolled to the section, but does not update when the user scrolls away. How can I make the active style update on user scroll ...

Ways to prevent body content from overlapping with footer content and appearing below

Currently, I am utilizing an autocomplete text box where the scroll bar exceeds based on dynamic values. However, if more values are displayed in the text box, the scroll bar automatically extends to exceed the footer of the page, resulting in two scroll b ...

The final row continues to display the <div> element

Currently, I am in the process of learning PHP/MySQLi and there is something I need assistance with that I haven't been able to find a solution for online. In the forum script that I am developing, I have been using <div class="hr"> </div> ...

Tips for positioning the navbar to avoid covering the logo:

I am experiencing difficulty in aligning my navbar. When I resize the window, the navbar overlaps with the logo... Here is the Fiddle Here is the code: <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation" style="background: rgba(0,0, ...

In the latest version of Bootstrap, the carousel has been redesigned to smoothly transition across the entire page, providing a

I am currently in the process of learning Bootstrap 5 and decided to create a simple carousel by referring to the official documentation on Bootstrap 5 Carousel. Following their instructions, I copied their code and integrated it into my template. Howeve ...

A guide on incorporating a set of components to be utilized as custom HTML elements in Angular

I am in the process of revamping my application to be more modular on the UI side, with a focus on separating different elements including: App header Left navigation panel Main content on the right side of the nav panel I have successfully figured out ...

The :not() selector in CSS3 seems to be ineffective on sibling elements

In my simple design, I have specified that text should appear in red unless it is within a footer element. This style is applied successfully to p tags, a tags, and others. However, for some reason, the styling does not work when I target the footer tag. ...

Should WebSocket be used for inter-server communication in our HTML5 application?

My task is to create a solution for an existing system that requires secure two-way communication between multiple applications and services. The current setup is as follows: A HTML5 Kiosk application needs two-way communication to exchange data with a s ...