Troubleshooting Bootstrap 4 col-sm-6 alignment issue: Elements failing to align side by side

I'm facing a challenge with my code where I want to display two containers side by side on mobile, like this:

https://i.sstatic.net/DslMK.png

However, instead of the desired output, both containers are appearing stacked on top of each other:

https://i.sstatic.net/bOkVa.png

Even though I have used col-sm-6 as the div class for each container. Here's the code snippet:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
      <div class="text-center mx-auto our-scope-card mb-5">
        <div class="col mt-5 mb-3">
          <h1>CSS Align</h1>
        </div>
        <div class="row pt-4 justify-content-center">
          <div class="col col-lg-8 col-10">
            <div class="row">
              <div class="col-xs-6 col-sm-6 col-lg-4 col-md-6 col-12 pb-5 pt-5">
                <div class="mb-5 mt-3">
                  <img src="http://via.placeholder.com/140x100" alt="Dev" />
                </div>
                <p class="font-weight-bold">Application development</p>
                <p>For businesses of all sizes and industries, we can custom design an application to fit your needs.</p>
              </div>
              <div class="col-xs-6 col-sm-6 col-lg-4 col-md-6 col-12 pb-5 pt-5">
                <div class="mb-5">
                  <img src="http://via.placeholder.com/140x100" alt="Mobile Apps" />
                </div>
                <p class="font-weight-bold">
                  Mobile applications
                </p>
                <p>Whether iOS or Android, we focus on including features that will bring you ROI and differentiate your platform.
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
      

Can anyone provide some guidance on how I can achieve the desired layout?

Answer №1

For smaller mobile screens, remember to use the col-xs-6 class.

Specifically designed for extra small devices like phones with a width less than 768px.

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 background image is failing to display

I am currently working on a subpage for my website that includes a navigation bar and footer. I am looking to add a background image behind the navigation bar, similar to this design. https://i.stack.imgur.com/j6fDZ.jpg After trying various methods, I at ...

What is the best way to pass the record ID of the row when the user clicks on the edit button?

The substance ID saved to the session is always the last record ID in the table. I need to send the record ID of the row when the user presses the edit button. Currently, every time a button is selected, the record ID sent is the last one in the table. I ...

When swiping right with Swiper.js, the slides are jumping by all, skipping the following slide, but the left swipe functions correctly

Here is the code I used for my swiper element: new Swiper("#swiper-pricing", { slidesPerView: 1.3, spaceBetween: 30, centeredSlides: true, loop: true, keyboard: { enabled: true, }, autoplay: { delay: 50 ...

Why is my form not responding to jquery closest function?

In the code snippet below, I am attempting to add form code inside a form. However, because the form ID changes, I am using closest(); to achieve this. $("#contentarea").closest("form").html("some code"); Check out the demo here. ...

Steer your cursor and tap on the tab to open it

I'm trying to click on the "Get" tab shown in this screenshot, but I can't seem to make it work. Can anyone offer some assistance? Here's the HTML snippet: <div id="schemeSlabTab" class="ui-tabs ui-widget ui-widget-content ui-corner- ...

Tips for Creating a Fixed-Width Element

I am struggling with creating text wrapping around a box inside a full width page template on Wordpress. The plugin developer suggested wrapping the text inside a fixed width element, but I am unsure how to do this. Any assistance would be greatly apprecia ...

What is the best way to keep a dropdown list menu next to the selected dropdown button as the user scrolls?

I recently encountered a problem similar to the one on this page within my App. Upon selecting the drop-down list, the corresponding menu opens as expected. However, when the user scrolls down the page, the drop-down menu remains in its original position. ...

Tips for adjusting the default width of the container in Bootstrap3

Modifying the default width of a Bootstrap 3 container without causing any alignment issues can be a challenge. The default container width currently set is .container { width: 1170px; } However, I am looking to adjust it to .container { wid ...

"Embedding a Highcharts web chart within a pop-up modal window

I am looking to incorporate a Highcharts web chart onto a specific part of a Bootstrap modal, while ensuring the size remains dynamic along with the modal itself. Here's what I have attempted so far: Sample HTML code: <td><a href="#">${ ...

Using `justify-content: space-around` on a nested element within a class will not produce the desired spacing effect

This particular piece of code is functioning correctly: aside { /* Customize styles for the aside element */ flex: 0 0 40px; display: flex; flex-direction: column; justify-content: space-around; align-items: center; background-color: #2800da; ...

Develop a JavaScript function

Is there a way to define the properties of an object in HTML and then create a function in JavaScript that will return that object? This is the HTML code: <object id="desktop" type="application/x-desktop" width="500" height="200> <param name="cl ...

Adjusting the transparency of the background color seamlessly without the need for an image

After creating a div element with a green background color, I am looking to progressively change the opacity of the color from top (darkest green) to bottom (lightest, white). Is there a CSS-based way to achieve this effect without resorting to using an ...

What is the best way to set an image as a navigation background in Bootstrap 4?

How can I incorporate a patterned background with Bootstrap 4? I am in the process of transitioning my website to use Bootstrap, and currently, I have a header with a dark background that looks good. However, I would like to replace the plain dark grey ba ...

Why is the background of the wrapper not changing when I try to update it?

I'm having an issue with changing the background of my wrapper in a responsive WordPress theme. When I try to change the background, it doesn't update, but when I change the border, it does. I want my wrapper content to have a transparent backgro ...

HTML min-width is not being considered by the media query breakpoint

After resizing the browser window to less than 480px, my site reverts back to its original style (the css not defined inside the mixins). I attempted to limit the html with min-width, but despite the browser displaying a horizontal scrollbar, the css still ...

AngularJS using the ng-controller directive

I am presenting the following HTML code excerpt... <!DOCTYPE html> <html lang="en-US" ng-app> <head> <title>priklad00007</title> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angula ...

Display a placeholder if image source is not working or missing

Looking to display a logo in next.js, my plan is to show a span if the logo is not available and hide it if it is. <div className='brand'> <Link href="#"> <img src="#" alt="UnSet" /> <s ...

What is the process for displaying a partial view upon clicking an image?

I am reaching out to you because I need some guidance. My goal is to design a webpage featuring 3 clickable images. Upon clicking an image, I want a specific partial view to display on the same page. If another image is clicked, all other partial views ...

Is there a way to style alternate iframes using CSS?

I need to select every second iframe in the image provided. Is it possible to achieve this using nth-child? I have tried with the following code (unsuccessfully): #main iframe:nth-child(2n+2) ...

Creating unique styles for mat-option with Active and Hover effects in Angular Materials

Struggling to find a CSS solution for changing the text color of the active option and on hover. The lack of documentation on styling angular materials in CSS is proving to be an issue. I've tried using .mat-option.mat-selected { background: red; ...