Bootstrap troubleshoot: Solving grid and card complications

I have nearly completed a crucial section in my Django project by implementing panels that contain a set of cards. Using Bootstrap 3 (BS3), I have integrated cards from BS4 into BS3.

Encountering a peculiar issue, I seek advice from the community due to the strange behavior observed.

The Challenge :

Upon opening the dropdown from Publication n°1 and Publication n°2, there is an offset visible in the animated image below, affecting the cards in the second row.

[![see animated image][1]][1]

My inquiry is: How can I reconfigure the bootstrap components in my code to rectify this abnormal behavior?

Desired Card Behavior:

My objective for each card is to: open the card > create an offset for the entire row below

[![desired card effect][2]][2]

Undesired Behavior:

This is the kind of behavior I want to avoid:

[![undesired behavior][3]][3]

Code snippet :

The following represents my code:

{% for category in research_categories|dictsort:'name' %}
  <div class="panel-group accordion" id="accordion_{{ category.id }}" role="tablist"
       aria-multiselectable="true">
    <div class="panel panel-default">
      <div class="panel-heading" role="tab">
        <h4 class="panel-title">
          <a data-toggle="collapse" data-parent="#accordion_{{ category.id }}"
             href="#collapseOne_{{ category.id }}" aria-expanded="true" aria-controls="collapseOne">
            <i class="more-less glyphicon glyphicon-plus"></i>
            {{ category }}
            {% for item in category.publication.all %}
              {% if item.new_publication == True %}
                <span class="glyphicon glyphicon-flag"></span>
              {% endif %}
            {% endfor %}
          </a>
        </h4>
      </div>
      <div id="collapseOne_{{ category.id }}" class="panel-collapse collapse" role="tabpanel"
           aria-labelledby="#accordion_{{ category.id }}">
        <div class="panel panel-default subpanel ">
          <div class="row">
            {% for element in research_publications|dictsort:'pub_id' %}
              {% if element.category|stringformat:"s"  == category|stringformat:"s" %}
                <div class="col-md-4">
                  <div class="card" style="width:350px">
                    <img class="card-img-top" style="width: 350px; height: 350px" src="{{ element.cover.url }}" alt="Card image">
                    <div class="card-body">
                      <h4 class="card-title">{{ element }} - {{ element.pub_id }}
                        {% if element.new_publication == True %}
                          <span class="glyphicon glyphicon-flag"></span>
                        {% endif %}
                      </h4>

                      <button class="btn btn-default display-document" type="button" data-toggle="collapse"
                              data-target="#dropdown_{{ element.id }}"
                              aria-expanded="false"><span
                        class="glyphicon glyphicon-chevron-down"></span></button>
                      <div id="dropdown_{{ element.id }}" class="collapse">
                        <div class="publication-title">
                          <table class="table table-condensed">
                            <tbody>

                            {% for item in test_research %}
                              {% if item.publication|stringformat:"s"  == element|stringformat:"s" %}
                                <tr>
                                  <td class="col-md-5 document-title">{{ item.title }}</td>
                                </tr>
                              {% endif %}
                            {% endfor %}

                            </tbody>
                          </table>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              {% endif %}
            {% endfor %}
          </div>
        </div>
      </div>
    </div>
  </div>
{% endfor %}

The code snippet above is a simplified version of my initial code for the purpose of troubleshooting.

Feel free to request my CSS segment if needed; however, I suspect the issue stems from the bootstrap grid configuration. Your assistance is greatly appreciated!

Thank you in advance!

Answer №1

It appears to be a problem with the clearfix. Have you considered including this CSS code:

.panel.panel-default.subpanel > .row  > .col-md-4:nth-child(3n+1) {
  clear: both;
}

Depending on the context of your other code, additional adjustments may be necessary for various screen sizes.

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

What steps should I follow to ensure that the "-> comes after the text?

Here is the link to my page: . Currently, the arrow appears under the text. I am looking for a way to rearrange it so that the arrow comes after the text while still maintaining its hover effect. Can you provide any suggestions? ...

The dropdown function in Bootstrap seems to be malfunctioning

I have implemented a basic dropdown menu using the code below: <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" ...

Problem with Jquery hover or mouse enter show/hide functionality

I am currently experimenting with displaying hidden text when the mouse enters a div and hiding it when it leaves. Here is the progress I've made on my JSFiddle: $(document).ready(function() { $(".image").mouseover(function(){ $(".hover").show ...

JavaScript's addition of CSS animation not functioning as intended

I am facing an issue with a web page utilizing Bootstrap 5. The webpage consists of one element stacked on top of another. My goal is to fade-out the top element after a certain period. Here is what I have tried: HTML <div id="host" class=&qu ...

Why is it that Lotus Notes is unable to render this HTML code properly?

I am having trouble with an email that displays properly on every platform except Lotus Notes. Can anyone provide insight as to why this email is not rendering correctly in Notes? Here is a screenshot: img (please note the images are for demonstration pu ...

How to position the play button in the center using Material UI and Flexbox

Seeking advice on achieving a centered play button with borders in this layout. Struggling with flexbox to position the play button within the code provided. function Tasks(props) { const { classes } = props; return ( <div className={classe ...

The issue with the Bootstrap 5 navbar in an Angular project is that it expands properly but fails to close when

I am currently working on developing a Single Page Application using Angular 12 and Bootstrap 5. As part of this project, I have created a shared navbar component. The issue I am facing is that when the navbar transitions to the hamburger menu button for ...

Generating values in a loop - mastering the art of creating data points

My goal is to create a variable within a loop: box-shadow: 835px 1456px #FFF, 1272px 796px #FFF, 574px 1357px #FFFand so on... The concept is simple: box-shadow: x1 y1 #fff, x2 y2 #fff, x3 y3 #fff, x4 y4 #fff ... xn yn #fff. I attempted to achieve this ...

The parent div isn't properly extending to accommodate the table, and the columns aren't aligning correctly within the table when using CSS flexbox

I have a scenario where I need a table inside a div to take up the entire space of the div, with the second column and its inputs expanding as much as possible to fill the width (i.e. col1+col2 = div width). Due to being nested within another div, absolut ...

Collaborate on sharing CSS and TypeScript code between multiple projects to

I am looking for a solution to efficiently share CSS and TS code across multiple Angular projects. Simply copy-pasting the code is not an ideal option. Is there a better way to achieve this? ...

Create a heading for the selection menu

I need to customize a dropdown list on my page so that the text "Select Language" is always displayed to the user, regardless of whether they make a selection from the dropdown. Even if the user chooses "Option 1" or "Option 2," the default text should sti ...

Rotation using CSS in Internet Explorer 8

Can anyone help me with a CSS solution for rotating elements in IE8? I've tried some solutions that claim to work in IE8, but they're not working for me. What am I doing wrong? Here's what I've attempted: <!DOCTYPE html> <htm ...

Can you please explain the purpose of this function?

I came across this code snippet on a website and I'm curious about its function and purpose. While I'm familiar with PHP, HTML, CSS, and JavaScript, I haven't had the chance to learn JQUERY and AJAX yet. Specifically, I'm interested in ...

Poorly positioned text displayed inline in HTML

My attempt to place a title in a div toolbar next to some images has hit a snag. The text is not aligning correctly; it should be positioned at the top of the toolbar, but it stubbornly remains at the bottom without budging. I wish for it to be vertically ...

Stop the default drag behavior on an input range element in VueJS

Is there a way to disable the default drag functionality of an input range element without affecting the click feature? Users should be able to change values by clicking instead of dragging. <input type="range" min="0" max=& ...

JavaScript Accordion malfunctioning

I'm attempting to implement an accordion feature for each row of an HTML table using the script provided below HTML <table class="list" id="table" data-bind="visible: !loading()"> @*<table class="productTable" data-bind="sortTable:true" ...

Creating Transparent Rounded Backgrounds in Google Chrome Packaged Apps: Achieving the same look as Google Hangout app

Looking at the screenshot below, it is evident that the Hangout app has a fully transparent design with background shadow effect applied to it. I have tried various methods in vain, such as applying CSS styling to the "html" and "body" tags of the page, a ...

PrimeNG - Sticky header feature malfunctioning in the p-table

Hello there, I am currently using PrimeNG p-table which features both horizontal and vertical scrolling. My goal is to implement a sticky header for the table, so far I have attempted two methods: [scrollable]="true" scrollHeight="350px" ...

What is preventing me from using jQuery to dynamically insert HTML onto the page?

Below is the HTML code for a Bootstrap Modal dialog box: <div class="modal fade" id="rebateModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> ...

Prevent css from reverting to its original rotation position

I attempted to style the navigation list with the following CSS: #navlist:hover #left-arrow { border-top: 10px solid white; position: relative; transform: translateX(120.2px) rotate(180deg); } Would it be better to use jQuery for the rotation ...