Flexible Columns with Bootstrap

After completing the construction of my website, my current focus is on making it responsive. My inquiry pertains to a specific page on my site that consists of 8 containers with full viewport height. These containers are arranged into two equal columns positioned next to each other horizontally using Bootstrap 4. I am interested in knowing if it is feasible to stack these two columns vertically below one another for devices smaller than an iPad or tablet. If this can be achieved, what steps should I take to implement it? It is crucial to note that I only wish for the columns to align in this manner on small devices.

Answer №1

It seems like you are experiencing issues with collapsible columns on your website.

If your columns are not collapsing at specific screen widths, there could be a few reasons for this:

  1. Your Bootstrap framework may not be linked properly. Make sure to use the correct version of Bootstrap (e.g., 4.1.3 minified).
  2. You might be using an outdated version of Bootstrap that is not compatible with your current code.
  3. Ensure that your columns are wrapped in a <div class="row"> element.
  4. Don't forget to specify the collapse state of the column using classes like col-sm, col-md, col-lg, or col-xl.

In Bootstrap, columns should stack automatically at 768px width when using the col-md class. The behavior changes for each collapsible state.

For more information on Bootstraps' grid system, visit this link.

Here is a code snippet for reference:

.container .row .col-md-4 {
  border: 1px solid red;
}
<!-- BOOTSTRAP CDN LINK -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">


<div class="container">
  <div class="row">
    <!-- Make col-4, col-[sm/md/lg/xl]-4 for different screen widths -->
    <div class="col-md-4"><p>Column 1<p></div>
    <div class="col-md-4"><p>Column 2<p></div>
    <div class="col-md-4"><p>Column 3<p></div>
  </div>
</div>

*PLEASE NOTE: To test this code snippet, expand it to full-screen and adjust the width of the window until the columns start to collapse.

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

Retrieving a PHP script from within a DIV element

I am seeking assistance to successfully load a PHP file from a DIV call. Below is the code I have used: <html> <head> </head> <body> <script class="code" type="text/javascript"> $("#LoadPHP").load("fb_marketing ...

Tips for properly filling empty spaces in a flexbox layout using HTML

Is there a way to fill in the gap using CSS so that boxes automatically take up the empty spaces, even if they are of different sizes? How can I make sure the boxes adjust automatically as the screen size changes? .c1 { display: flex; flex-wrap: w ...

Dynamic adjustment of div size to fit the screen when resizing, based on the svg proportions

Is it possible to use CSS and HTML to automatically adjust the colored divs around the black SVG to fill in any extra width or height of the pink space when the screen size is resized? There is a pink div behind the logo that serves as an example of the sp ...

Enhance your photographic experience with the JavaScript Camera API on Android (Froyo

I have been attempting to utilize the JavaScript Camera API through the Android browser, as showcased at Google IO on Froyo. Despite having Froyo on my Nexus1, I am encountering difficulties accessing navigator.device and navigator.camera properties, bo ...

Wordpress Issues with Displaying Arabic Text Correctly

The issue arises when displaying Arabic text in menus, both the top menu and main menu. The text appears distorted and unreadable, with characters like 2Ø®Ø§Ù†Ù‚Ø§Û showing up. However, in other areas of the page such as the body content, the ...

What is causing this regular expression to not find any matches in the VSCode search and replace function?

Currently utilizing VSCode for my code editing needs. https://i.sstatic.net/49OmA.png Displayed below is a screenshot illustrating the search options I have chosen: https://i.sstatic.net/ILcNv.png The regex expression I'm attempting to use functio ...

Steps to ensure checkboxes are enabled for selection only when another box has been checked

Consider having 3 checkboxes: 1 'parent' checkbox and 2 'child' checkboxes. If the parent checkbox is selected, you should be able to select either or both of the child checkboxes. If the parent checkbox is deselected, neither of the ...

The grid images transition at set intervals using jQuery or another JavaScript framework

I am facing a challenge with developing an image grid that transitions some images at random intervals using either jQuery or another method in JavaScript. It's important to note that I don't want all the images to change simultaneously; each gro ...

Using Javascript to dynamically flash-highlight text on a webpage when it first loads

I am looking to create a special highlight effect that activates when the page loads on specific text. Let's focus on the element with id="highlight me". The highlight should glow twice around the selected container before fading out. For a clear unde ...

Creating a jquery DataTable from HTML generated by angular $sce can be done by following these steps

I have created an Angular controller that takes data and generates an HTML table from it. The generated table is being displayed on the page. Now, I want to apply jQuery data tables using that scope variable. The variable contains the HTML code of the tabl ...

`The header navigation is not responding to window resizing functionality`

I am currently developing a header navigation that consists of a logo on the left side, a profile icon on the right side, and some navigation links in the middle. A left slide menu has been implemented to trigger when the window width is less than 700px. ...

Utilizing Semantic HTML to Showcase a Product Comparison

As I prepare to showcase various products on a website for customers to choose from, each with its own name, description, and list of pros and cons compared to other products, I find myself unsure about the best way to structure the HTML. While headings a ...

What is causing the horizontal misalignment of these divs? Why are they breaking onto separate lines?

This HTML code snippet contains a div element with nested divs styled with different border properties. The red divs are not displaying in the same horizontal row. What could be causing this issue and how can it be resolved to ensure that all red divs are ...

Clashing CSS Styles: Font Size Edition

Can someone explain how CSS font sizes work? I set a specific line to be 200% font size, but changing the body font size affected it. Shouldn't the line maintain its specified size? When the body font size is changed from 12pt to 8pt, the line "There ...

Creating a unique look for unordered list items in a dropdown navigation

I'm currently working on creating a drop-down menu using nested unordered lists. The functionality of the menu is all set, but I'm running into some styling issues. The main link that triggers the drop-down should have a blue background with whit ...

When trying to link "/%PUBLIC_URL%/manifest.json" within the workspace, the process failed due to an incorrectly formatted URI while operating on Netlify

My website is encountering an error when it goes live, but the error does not appear in local host, only for the live build. I've been trying to find a solution without success. Any help would be greatly appreciated! [error shown on inspecting the web ...

Inject CSS values dynamically

I am currently working on dynamically setting the color of a div. To provide some context, let's examine the following: <!doctype html> <head> <link rel="stylesheet" href="style.css"> </head> <body> <div clas ...

The items in the Bootstrap dropdown are not displaying

I am currently working on a project using Angular 12, and I encountered an issue with my Bootstrap dropdown menu not displaying any items. Below is the HTML code snippet causing the problem: <nav class="navbar navbar-expand navbar-dark"> ...

Attempting to align a navigation block next to an SVG image

On my website, I envisioned a photoshopped image featuring a SVG picture of a book on the left and a "navigation block" on the right. The navigation block consists of links that redirect to other pages but it's not displaying properly. You can view th ...

Troubleshooting issues with adding child elements in JavaScript

Styling with CSS: ul #allposts li{ height: 50px; width: 50px; background-color: yellow; border: 1px solid yellow; } Creating HTML structure: <ul id = "allposts"></ul> Adding JavaScript functionality: var container = documen ...