arranging divs consecutively in a responsive design

Here is some sample HTML and CSS code:

<div class="section group">
    <div class="col span_1_of_3">
     <div id="busqueda">
         content
      </div>
    This is column 1

    </div>
    <div class="col span_1_of_3">
    This is column 2
<div id="busqueda">
         content
      </div>
    </div>
    <div class="col span_1_of_3">
    This is column 3
<div id="busqueda">
         content
      </div>
    </div>
</div>

The accompanying CSS code is as follows:

/*  SECTIONS  */
.section {
    clear: both;
    padding: 0px;
    margin: 0px;
}

/*  COLUMN SETUP  */
.col {
    display: block;
    float:left;
    margin: 1% 0 1% 1.6%;
}
.col:first-child { margin-left: 0; }

/*  GROUPING  */
.group:before,
.group:after { content:""; display:table; }
.group:after { clear:both;}
.group { zoom:1; /* For IE 6/7 */ }

/*  GRID OF THREE  */
.span_3_of_3 { width: 100%; }
.span_2_of_3 { width: 66.13%; }
.span_1_of_3 { width: 32.26%; }

/*  GO FULL WIDTH BELOW 480 PIXELS */
@media only screen and (max-width: 480px) {
    .col {  margin: 1% 0 1% 0%; }
    .span_3_of_3, .span_2_of_3, .span_1_of_3 { width: 100%; }
}

The issue I'm experiencing is that the divs inside each .span overlap when I resize the window. I would like them to stack one below another. The CSS for the specific div is as follows:

#busqueda {
    /*white-space: nowrap;*/
  display: inline-block;
  background-color: #FFFFFF;
  color: #000000;
  border: 5px solid #6D6D6D;
  padding: 19px;
  font-family: 'trebuchet ms';
  font-style: oblique;
  font-weight: normal;
  font-variant: normal;
  border-radius: 13px;
  margin-right: 55%;
  border-color:#fd8a17;
  margin-bottom:50px;
}

Do you have any suggestions on how to resolve this issue? I've attempted floating them but it didn't work as expected.

Answer №1

It appears that the HTML structure for the first column is different from the other two columns. To address this, I have made some adjustments: https://jsfiddle.net/qrbcf8ne/1/ Below is the modified code with an additional div in each span:

<div class="section group">
    <div class="col span_1_of_3">This is column 1
        <div id="busqueda">content11</div>
        <div id="busqueda">content22</div>
    </div>
    <div class="col span_1_of_3">This is column 2
        <div id="busqueda">content21</div>
        <div id="busqueda">content22</div>
    </div>
    <div class="col span_1_of_3">This is column 3
        <div id="busqueda">content31</div>
        <div id="busqueda">content32</div>
    </div>
</div>

I hope this solves the issue.

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

Switch the default blue color of Ngx-Pagination to a different color option

I am currently using the ngx-pagination plugin in my Angular 16 project and I would like to change the default blue color to a different one, is there anyone who can assist me with this? https://i.sstatic.net/NNuy7.png This is the HTML code snippet: < ...

Is there a way to add new content to my HTML page while also updating the DOM without having to refresh the entire page?

Whenever I add new data to a table, the datatables plugins fail to recognize it <javascript>$(document).refresh</javascript> Could there be a function similar to document.refresh that I should be using? ...

Puzzling blank area found beneath the form component

There seems to be some extra space at the bottom of a form when it's placed inside a div. How can we remove that unwanted space? In examples from stack overflow, the extra space is not visible in the code snippets provided. However, it appears elsewh ...

Is it possible to retrieve elements by their ID when the ID values are constantly changing?

I'm facing an issue with accessing dynamic IDs using `getElementById`. I require this value to perform random calculations involving different elements. MY CODE <div class="col-lg-4" v-for="data in datas"> <button class="btn btn-outline-d ...

What is the best way to apply a className to a component using styled-components in React?

NavigationStyles.js import styled from 'styled-components'; export const Navigation = styled.navwidth: 100%; ; export const MobileNavMenu = styled.ul` height: 80px; .navbar_list_class { font-size: 2rem; background-co ...

Align Bootstrap list items vertically

I'm facing a challenge with aligning the yellow list item blocks vertically in my design. The issue arises because the black dog item is not aligning properly due to its image being shorter than the other two blocks. I've been struggling to find ...

"Can someone help me with aligning to the right in a bootstrap card header

I'm facing an issue with aligning the h3 and input-group next to each other in a Bootstrap 4 card. Initially, I attempted adding float-right to the input-group, but it did not yield the desired result. I also experimented with making the h3 and input ...

Incorporating an SVG with CSS styling from a stylesheet

After exploring various articles and questions on the topic, I am yet to find a definitive solution. I have an external file named icon.svg, and my objective is to utilize it across multiple HTML files with different fill colors and sizes for each instanc ...

Sizing Children in Ant Design Inline Forms

I'm having trouble making my form inline with a select taking up 60% of the space and a submit button taking up the remaining 40%. Every time I try to do this, the select and button end up sizing themselves incorrectly. The select starts out very smal ...

Constructing markup for text and subtext in a meaningful manner

I am in the process of creating a roster of Employees and their dependents on a webpage and I could use some guidance on the best way to structure this information. Here is an example of the content on my page: <div> John Smith Employee - 03/01/198 ...

Tips for utilizing FixedHeaderTable - Basic instructions required

After doing extensive research, I stumbled upon this plugin called Fixed Header Tables. Despite following the instructions provided on the main website, I couldn't get it to work. I was aiming to create a table with a fixed top row and left column fu ...

Is there a way to verify that all CSS files have been successfully downloaded before injecting HTML with JavaScript?

I am looking to dynamically inject HTML content and CSS URLs using JavaScript. I have more than 3 CSS files that need to be downloaded before the content can be displayed on the page. Is there a way to check if the aforementioned CSS files have finished ...

How can I create a timed slideshow of images?

Is there a way to make a series of images slide automatically after closing or stopping a video? To see the specific website in question, click here: Upon visiting the site, a video pops up. How can I program the image slides to transition every 7 secon ...

Having trouble positioning grouped buttons in jQuery Mobile?

In the controlgroup container, I have included the data-type="horizontal" attribute. This container contains a select menu and a plus icon, giving the user the option to select an existing category or add a new one. I am looking to position the "+" icon in ...

connect a column from a separate array in pdfmake

In my current project, I am looking to link the values of an array that is different from the one present in the initial two columns. Is this achievable? (The number of partialPrice values aligns with the number of code entries). Despite several attempts ...

HTML5 Boilerplate and optimizing the critical rendering path by deferring scripts and styles

Previously, I constructed my website layouts using the HTML5 Boilerplate method: incorporating styles and Modernizr in the head section, jQuery (either from Google CDN or as a hosted file) along with scripts just before the closing body tag. This is an exa ...

Arranging a layout of interactive div elements

I am currently working on setting up a responsive grid within my HTML code. The content is contained within a bootstrap .container and consists of multiple div elements. The number of these divs can vary based on external factors, and I need the layout to ...

My goal is to generate four HTML buttons that trigger specific functions: addition, subtraction, multiplication, and division

I am currently learning JavaScript, and I am facing some challenges with my assignment. The task is to create four buttons in HTML that trigger different functions - addition, subtraction, multiplication, and division. The goal is for the user to input two ...

Guide on clearing the value of the first textarea and transferring it to the second textarea using JavaScript

I have encountered an issue where the first textarea value is being copied into the second textarea because I am using the same id for the 'add more' functionality. Below is the code snippet: <div id="divShortAnswerOption_Templated"> & ...

Create styles for each component based on their specific props when designing a customized Material-UI theme

I am having trouble styling the notchedOutline of a disabled <OutlinedInput /> in my custom MUI theme. My goal is to make the border color lighter than the default color when the input is disabled. Here is what I have attempted so far: const theme = ...