When viewed on a mobile device, columns with the class "bootstrap: col-xs-6" will expand to fill

I am currently working with bootstrap and I am trying to divide a row into 2 columns when viewed on a mobile device. Below is the code snippet I have:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
 <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" ></script>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" >
   

    <title>test mobile</title>
  </head>
  <body>
    <div class="container">
      <div class="row">
        <div class="col-xs-6 col-sm-8 ">col-xs-6 col-sm-8</div>
        <div class="col-xs-6 col-sm-4 ">col-xs-6 col-sm-4</div>
      </div>
      </div>
  </body>
</html>

Although the code displays correctly in medium view, it does not work as expected in mobile view. The columns take up the full line space instead of dividing the width evenly.

If you have any insights on what might be causing this issue and how to resolve it, please let me know. Thank you!

Answer №1

For those who are utilizing the most recent version of Bootstrap, it appears that the "xs" class has been eliminated. Simply replace it with col-6 instead of col-xs-6 and everything should work smoothly.

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

Failed to load resource: The server returned a 404 error when deploying React on Github Pages

Currently working on a React App. Started by deploying on GH page with SASS, but encountered an issue. Can anyone provide guidance on resolving this? Unsure of the specific code needed, so just looking for which part of code is necessary to add. https:/ ...

Tips for utilizing div as a dropdown menu

I have a challenge with the following code and I am looking to make it function like a dropdown one by one For example: ABCD ABCD 1234 ABCD 1234 abcd <ul class="first"> <li class="first-a"><a href="https://someurl">ABCD&l ...

The nested div escapes from its parent div despite the application of clearfix and the correct positioning of relative and absolute elements

Hey there, I have a question about using relative and absolute positioning along with applying clearfix to the main container in my code. The layout is quite simple - a nav-bar with a drop-down menu at the top, followed by a hero image spanning the screen, ...

Contrasting importing CSS directly in index.html versus using styleUrls in Angular 5

My landing page and dashboard components have different CSS styling, causing one of them to not function properly depending on the CSS. I tried removing these two lines from index.html: <link href="./assets/css/bootstrap.min.css" rel="stylesheet" /&g ...

setting different iframe widths for desktop and mobile views

I am working with an iframe and facing a challenge. I want to make it full screen width on mobile devices, but only half the screen width on a normal monitor (100% and 50%, respectively). The minimum specification for the mobile device would be iPhone, alt ...

Ensure proper spacing between the axis and text on your NVD3 charts by adding a space

My attempt to identify the classes responsible for styling the axis was unsuccessful. It left me feeling lost. I struggled to pinpoint the correct class to use in order to create some space between the axis and the text. Any suggestions on how I could ta ...

What steps can I take to stop full-width images from stretching to fit the entire body size when placed within a flex container?

I'm having trouble with my layout - specifically, I have one container with four columns. It looks fine when I manually set the image sizes in each column, but I want to use percentage widths for more flexibility. However, when I do this, the images e ...

Managing images in JavaScript while conserving memory

Welcome I am embarking on a project to construct a webpage using HTML, CSS, JavaScript (jQuery), and nearly 1000 images. The length of the HTML page is substantial, around 5000px. My vision involves creating a captivating visual experience for users as t ...

Is there a software available that can transform <style> blocks into inline CSS code?

Is there a tool available that can convert <style> blocks to the corresponding style attributes in an HTML file? For instance, if we have the following input file: <html> <head> <style> .myclass { color:red; } </style> &l ...

Tips to maintain the integrity of "text-decoration: underline" when adding positioning to the child <span> element

Explaining the rationale behind it, I have opted for relative positioning on <span> within <a> to make a slight adjustment in the text position enclosed by <span> (raising it 2px higher than its default placement). However, this causes th ...

Icon shrinking when de-hovered via JQuery, Javascript, and CSS techniques

Looking for a way to make three social icons grow on hover and then gradually shrink back when the user stops hovering? Wondering if there's a solution using JavaScript, CSS, or jQuery? ...

The Bootstrap navigation menu is not responsive as expected

Below is the HTML code for the navbar: <nav class="navbar navbar-light" style="background-color: #967BB6;"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" ...

Delay the occurrence of a hover effect until the previous effect has finished executing

As I hover over an element, the desired animation is displayed while hiding other elements on the page. The challenge I'm encountering is that if I quickly hover over many divs, the animations queue up and hide the divs sequentially. I want only one ...

How to temporarily disable CSS hover effects

I have a menu with some links <ul id="nav"> <li> <a href="#">Project</a> <div class="subs"> <div> <ul> <li> <h3>Save</h3> <ul> <li> <a i ...

What is the best way to evenly space divs apart so that they perfectly align with the width of the screen?

How can I make three divs fit the screen without expanding, with each one touching a different edge of the screen? The first should touch the left edge, the second in the middle and the third on the right edge. Check out this code snippet for reference ...

Can an ID tag be used to dynamically change CSS content?

Is there a way to extract the IDs from HTML example: id="title1" so it can be used to display content in the CSS. <table class="layout display responsive-table"> <thead> <tr> <th class="th ...

Safari shows a contrasting outcome

Having an issue with compatibility in the safari browser You can check out the site here: The problem lies with the text inside the image, I want it to display properly like it does in Chrome. Here is the desired result for Safari as well. Below is the ...

Activate Popover on Third Click with Bootstrap 4

Is it possible to create a button that triggers a popover after 3 clicks and then automatically dismisses after one click using Bootstrap v4.3.1? Code: <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.mi ...

What is the best way to change the class of the inline table of contents element using JavaScript?

INQUIRY Hello, I am currently working on building a straightforward navigation site and I have a question regarding how to modify or add a class to one of the li elements within the inline table of contents (toc) on the right side. I want to style it usin ...

Is there a way to incorporate borders into JqTree?

I attempted the following .jqtree-tree .jqtree-element { border-color: black; border-width: 10px; } It seems that I may be overlooking certain elements to which this CSS should be applied ...