Collaboration of Bootstrap components

I am facing an issue with two divs that are supposed to be displayed side by side in a normal browser. However, when the browser window is resized, the first div loses its height and the second div overlaps into it. I attempted to set the body's min height to 100%, but unfortunately, this did not resolve the problem.

<div class="col-lg-8 col-md-8 col-sm-8">
<h1>Inventar</h1>
<div class="inventar">
<div class="img_div" id="822273846">
<img src="IMG URL" alt="" class="img-responsive">
</div>
</div>

<div class="col-lg-2 col-md-2 col-sm-2">
<div class="item-overview" id="detail_822273846">
<!-- IMAGE -->
<img src="IMG URL" alt="" class="img-responsive">
<!-- HR -->
<hr>
<!-- NAME -->
<h3>P90 | Sand Spray</h3>
<!-- DESCRIPTION -->
<p>Easily recognizable for its unique bullpup design, the P90 is a great weapon to shoot on the move due to its high-capacity magazine and low recoil. It has been spray-painted freehand with short, thick lines in contrasting colors.

<i>Perfect for the insurgent on the go</i></p>
<p>Type: Consumer Grade SMG</p>
<!-- HR -->
<hr>
<input type="submit" name="submit" class="btn btn-primary btn-lg btn-block" value="Sell"></button> 
<br/>
</div>
</div>

Answer №1

When the screen size is under 768px, use the xs attribute for column sizing.

Make sure to include 'col-xs-[size]' in your div elements. Example:

  <div class="col-lg-2 col-md-2 col-sm-2  col-xs-2">

It's also a good idea to enclose your columns within a row if you want them to display inline.

Snippet:

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />

 <div class="row">
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
<h1>Inventory</h1>
<div class="inventory">
<div class="img_div" id="822273846">
<img src="IMG URL" alt="" class="img-responsive">
</div>
</div>
   </div>
  
<div class="col-lg- col-md-2 col-sm-2 col-xs-2">
<div class="item-overview" id="detail_822273846">
<!-- IMAGE -->
<img src="IMG URL" alt="" class="img-responsive">
<!-- HR -->
<hr>
<!-- NAME -->
<h3>P90 | Sand Spray</h3>
<!-- DESCRIPTION -->
<p>Easily recognizable for its unique bullpup design, the P90 a great weapon to shoot on the move due to its high-capacity magazine and low recoil. It has been spray-painted freehand with short, thick lines in contrasting colors.

<i>Perfect for the insurgent on the go</i></p>
<p>Type: Consumer Grade SMG</p>
<!-- HR -->
<hr>
<input type="submit" name="submit" class="btn btn-primary btn-lg btn-block" value="Sell"></button> 
<br/>
</div>
</div>

</div>

Answer №2

When working with smaller screen sizes, it's important to ensure that divs are displayed side by side and not stacked on top of each other. One way to do this is by adding xs column classes to the divs.

<div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">

and

<div class="col-lg-2 col-md-2 col-sm-2  col-xs-2">

It seems like there might be a missing closing tag in your code before the second div element.

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 issue with mCustomScrollbar's "scrollTo" function not functioning properly has been detected within a single-page application

Although there are many similar questions out there, I have been unable to find a solution to my particular issue. In my single page application with metro style design, I am facing an issue where the scroll position does not reset back to its original pl ...

What is the most effective method for digitally collecting a signature?

Currently, I am in the process of developing a website application using PHP that demands a signature from the user. This particular section of the website will only be accessible on Windows-based tablets. Hence, my inquiry is as follows: What method wo ...

There appears to be an error in the @media CSS code that needs to be corrected

Attempting to use an @media query to adjust the height of an element on my website for mobile users. However, I am struggling to make the code work properly. Any assistance in understanding what mistake I'm making and guiding me in the correct directi ...

Tips for changing the dimensions of the canvas?

I'm struggling to display a photo captured from the webcam. The sizes are not matching up, and I can't pinpoint where the size is defined in the code. https://i.stack.imgur.com/Is921.png The camera view is on the left, while the photo should be ...

How can you ensure an element's height matches its width within an Ionic framework?

I am currently creating an application using the Ionic framework, and I am looking to set a square image as the background. The challenge is to ensure that the image scales appropriately for different screen resolutions; ideally, it should occupy the full ...

Issue with Bootstrap navigation bar not displaying on iPad devices

Currently, I am working on creating a custom bootstrap menu that displays properly on an iPad screen size. I have implemented the standard navbar code from Bootstrap with a few tweaks. While it works well on smartphones and laptops, the issue arises when ...

Problem with Bootstrap container-fluid overlapping with floated element

I am struggling with the layout of my card body, which includes a floating logo and rows enclosed in a container-fluid. While everything looks great in Chrome, I am facing alignment issues in Edge and Firefox. I have considered using absolute positioning ...

Sticky positioning with varying column widths

How can I create HTML and CSS columns that stick together without manually specifying the "left:" parameter every time? The current example in the fiddle achieves what I want, but requires manual setting of the "left:" value. Is there a way to make this m ...

Guidelines for utilizing the php mail() function

It seems that there is an issue with this code when running it on a local host versus a live server. I am attempting to use this code for a mail function, which works on another site but not on this one. I know the code will produce an error on localhost ...

Utilize jQuery to wrap text within <b> tags and separate them with <br> tags

Upon receiving output in html string format from services, I am presented with the following: "<html>↵<h1>↵Example : ↵<br>Explanation↵</h1>↵<hr>↵<b>key1 : ABCD <br>key2 : 2016-10-18-18-38-29<br> ...

How can I ensure that my boxes are aligned in a straight line?

I'm having trouble with applying the style="display: inline-block" to each div. Can someone please assist me? https://i.sstatic.net/Gi75l.png Below is my HTML code: <div class="hobby" style="display: inline-block"> <di ...

Modify the class's height by utilizing props

Using Vue 3 and Bootstrap 5, I have a props named number which should receive integers from 1 to 10. My goal is to incorporate the number in my CSS scrollbar class, but so far it's not working as expected. There are no error messages, it just doesn&a ...

Direct your attention to the div element using ng-click

I'm encountering a complex issue while developing an AngularJS input helper component for number fields in my web application. To better explain the problem, let me give you some background on how our components function: Each component consists of i ...

What is the process for registering a click using a class in jQuery and retrieving the ID of the clicked element?

Currently, I am working on developing a webpage where I need to use jQuery to register a click using the items class and then extract the ID of that particular object. For example: HTML: <div class="exampleclass" id="exampleid1"></div> <d ...

Emails sent through an HTML form submission should always include a valid "from"

I am currently in the process of creating a feedback form that allows individuals to provide anonymous feedback. I have explored nodemailer and node-sendmail, but I have encountered an issue with both requiring a from address. While I am aware that this ca ...

Align the checkbox input in the center of a flexbox container

I am in the process of creating a side menu with filters, and I need to design a row that includes an input checkbox along with some accompanying text. However, I am facing an issue where the checkbox does not center properly within the flex container when ...

Like the Word outline view, the list view can be easily collapsed and expanded with a simple click

I've seen a few examples, but I haven't been able to achieve what I'm looking for. I need to extract text from a field and convert it into an outline view similar to the one in Word. Is this possible? Any help would be greatly appreciated. I ...

Unable to fetch css file in Node.js

I am currently in the process of learning Node.js, but I have encountered a small issue with retrieving data from a css file. Interestingly, when I directly add the data to the index file's code, it seems to work perfectly. Let me share the relevant ...

Can I programmatically retrieve a comprehensive list of all global HTML attributes available?

Exploring the extensive list of global HTML attributes can be overwhelming, especially when considering how it continues to evolve with browser updates. Can JavaScript be leveraged to dynamically generate a complete list of these attributes without the ne ...

Showing Text Information from a distant web server's jQuery.getJSON() script

I am currently working on a personal project that involves displaying data from a remote server. The HTML code I am using looks like this: <script> jQuery.getJSON("http://someurl.com/something.cgi? AJZ=1&STOCK=S", function(data) { if (data.inform ...