Ignoring the "order" class on mobile in BootstrapLearn how to exclude the "order" class when

Is there a way to target the order classes specifically for larger screens?

I have two input fields with corresponding labels structured like this;

<div class="row">
  <div class="col-12 col-md-5 order-first order-md-5"><label class="form-label">Label for 1st input <small>(Explanation for first input)</small></label></div>
  <div class="col-12 col-md-5 offset-md-2 order-last order-md-10"><label class="form-label">Label for 2nd input<small>( Explanation for second input )</small></label></div>
  <div class="col-12 col-md-5 order-first order-md-5">
    <div class="form-group mt-2">
      <input autocomplete="off" type="text" class="form-control" placeholder="">
    </div>
  </div>
  <div class="col-12 col-md-2 align-self-center">
    <p class="form-group text-center mt-3">and/or</p>
  </div>
  <div class="col-12 col-md-5 order-last order-md-10">
    <div class="form-group mt-2">
      <input autocomplete="off" type="text" class="form-control" placeholder="">
    </div>
  </div>
</div>

The layout works perfectly on mobile devices, but I would like it to revert back to its original order without the use of order classes which appears as follows;

<div class="row">
  <div class="col-12 col-md-5"><label class="form-label">Label for 1st input <small>(Explanation for first input)</small></label></div>
  <div class="col-12 col-md-5 offset-md-2"><label class="form-label">Label for 2nd input<small>( Explanation for second input )</small></label></div>
  <div class="col-12 col-md-5">
    <div class="form-group mt-2">
      <input autocomplete="off" type="text" class="form-control"  placeholder="">
    </div>
  </div>
  <div class="col-12 col-md-2 align-self-center">
    <p class="form-group text-center mt-3">and/or</p>
  </div>
  <div class="col-12 col-md-5">
    <div class="form-group mt-2">
      <input autocomplete="off" type="text" class="form-control" placeholder="">
    </div>
  </div>
</div>

The current ordering is correct for mobile view, but it disrupts the desktop layout. While removing the order classes displays the desired arrangement for desktop, it affects the mobile display. Is there a method to enable the use of order classes exclusively for mobile devices?

Answer №1

Consider using a class such as .order-1 instead of order-first and any associated classes. Hopefully, this change will solve the issue for you.

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 is the best way to position a checkbox next to input fields?

I need help aligning a checkbox with the other input fields so that it lines up properly with the labels. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c3a1acacb7 ...

Is it possible to eliminate the input border within React-Bootstrap?

Struggling to remove the input borders of the Form.Control component in React-Bootstrap. Despite searching for answers, nothing has been able to solve this issue. I've attempted redefining the .css classes "input" and "form-control", trying to set th ...

Three divs aligned horizontally

Can anyone help me create a layout with a left menu, right menu, and a middle section with page content arranged like this example: I am attempting to build this layout using Bootstrap 4 for responsive design, but I am struggling to get all three menus to ...

JQuery not properly validating inputs with required attributes after creation

I am currently developing a contact form that includes an "alternative address" <div id='alt'> with toggleable visibility. Inside this div, there is a required <input> field. I encountered an issue where toggling #alt twice (thus hidi ...

What can I use instead of an IFrame?

Is there a better option than using an Iframe? I experimented with a div and the following CSS: div { width: 400px; height: 400px; overflow: auto; } and inserted the div: <div> <?php include "http://mydomainhere.com"; ...

When attempting to submit, the jQuery validations fail to function accordingly

I have created an HTML form along with jQuery for validation purposes. However, upon clicking the submit button, nothing seems to be happening. I am unsure if my form is properly connecting with the jQuery file or not. Can someone please review my code and ...

Using Vue components to import a CSS file from a Laravel directory

Currently, I am working on a 1-file component in Vue as part of my Laravel project for testing purposes. My CSS is written using Less and stored in a separate file. Despite my efforts, I have been unable to successfully include this file in my project. I h ...

What is the process for dynamically looping through a table and adding form data to the table?

I am in the process of developing an hour tracking website that utilizes a form and a table. Currently, I have implemented the functionality where the form content gets added to the table upon the first submission. However, I need it to allow users to inp ...

Stopping all other audio players when a new one is played in Angular

I am in the process of creating a website using Angular to showcase my music, and I am looking for a script that will pause other audio players when a new one is played. Does anyone have a solution for this? HTML <div> <img src="{{ image }}" a ...

Issue encountered while attempting to retrieve the element's styling attribute via the HTML console

Need help extracting the value of an element within the DOM. Specifically, I am interested in retrieving the "Active" value from the style attribute: <span ng-class="{'megatable-filter-box-txt-selected' : filter.value.length > 0}" class="n ...

Position 2 divs to the right, with one on top of the other

As I navigate through the challenges of using floats, I find myself back at square one. My goal is to have two divs of varying widths float to the right of my page. You can view the page I'm working on here: recipe page Any assistance in understandin ...

Placing two Slickgrid tables next to each other

Is there a way to arrange two slickgrid tables next to each other? Currently, I am creating two grids using grid = new Slick.Grid..., but the dimensions are hardcoded in CSS like this: #dynamic1 { /*this is grid one*/ position: absolute; top: 120px; ...

The implementation of CSS in one React component has an impact on the functionality of the Ant Design Select component in

I've run into a puzzling issue where importing CSS styles in one React component is impacting the appearance of Ant Design's Select component in another component. Let me break down the scenario: The setup involves two React components, namely P ...

What are the best techniques for recreating the "Price Compare" responsive card layout?

Comparison of Plans on Desktop: https://i.sstatic.net/fzTeOJF6.png Mobile Plan Comparison: https://i.sstatic.net/2FBEmdM6.png Hello there, I'm seeking suggestions for designing this particular section of the layout. This section is visible both i ...

Angular not executing Jquery script in included HTML files

Underneath is a simple jquery code snippet: $(document).ready(function() { $("h2").click(function(){ alert("Hello world"); }) }); After clicking on any h2 tag in the website, an alert message will display. The code functions properl ...

Tips for keeping the footer consistently at the bottom of the page without using a fixed position (to avoid overlapping with the main content)

I've been struggling to keep the footer at the bottom of my webpage. I came across a solution online suggesting to use fixed CSS positioning. However, when I applied this fix, the footer ended up overlapping with the actual content on the page. Is the ...

Navigation Bar with Dropdown Feature not Functioning Properly in CSS and HTML

I recently developed a website using CSS, HTML, and PHP. The main focus of my work has been on improving the navigation bar in the header section. However, after several hours of tweaking, I finally achieved the desired look for the navigation bar. Unfortu ...

What is the best way to align elements in a div or navigation section?

Behold, my masterpiece navigation bar: #main-nav-bar .nav-item { display: inline-block; padding: 0.5%; border-right: 1px solid white; } #main-nav-bar a { text-decoration: none; color: #CFCFE0; } <nav id="main-nav-bar"> <a href="#Ser ...

CSS button with folded corner illusion and dynamic transitions

I have been using the code provided below to create a folded corner effect on a button, but I am having trouble with the white background that appears in the upper left corner of the button. Is there a class I can use to make this transparent so that the y ...

I'm looking for assistance in changing my mascot image to a pixelated image when I hover over it. Can anyone provide guidance on how to achieve this?

Seeking assistance on how to change my mascot image to a pixelated image when hovered over. Any tips or advice would be appreciated! Here is the CSS I'm currently using: .mascot { display: block; margin-left: auto; margin-right: auto; ...