Creating time input forms that are responsive can be achieved by leveraging the features of Bootstrap

Currently, I am working on a Laravel project and I am facing an issue with making a form responsive. I have added the following viewport meta tag, but I have not seen any changes. Any suggestions on how to make this form responsive would be greatly appreciated. Thank you!

Below is the form in question:

  <section>
      <p>Gestion des horaires</p>
      <div class="row">
    <div class="col-4">
      <label>Lundi matin </label>
      <div class="row">
      <div class="col">
      <input type="time"  name="lun_mat1[]" /> 
      </div>
      <div class="col">
      <input type="time"  name="lun_mat1[]" />
      </div></div>
      </div>
      <div class="col-4">
      <label>Lundi après-midi </label>
      <div class="row">
      <div class="col">
      <input type="time"  name="lun_ap1[]" /> 
      </div>
      <div class="col">
      <input type="time"  name="lun_ap1[]" />
      </div>
      </div> </div>
      <div class="col-4">
      <input type="checkbox"  name="rememberMe"> Fermer
    </div>
    </div>
    </section>

https://i.sstatic.net/55Xiv.png

Answer №1

To create a responsive layout, you should specify the col numbers and breakpoints in your code. I have added col-sm-4 col-12 to your main columns, which means they will take up 4/12 of the width until the Small (576px) breakpoint in Bootstrap, and then expand to 12/12 width. You can learn more about Bootstrap breakpoints and cols here.

In addition, I have added the class="form-control" to your input fields to make them responsive as well.

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

<section class="container-fluid">
  <p>Gestion des horaires</p>
  <div class="row">
    <div class="col-sm-4 col-12">
      <label>Lundi matin </label>
      <div class="row">
        <div class="col">
          <input type="time" class="form-control" name="lun_mat1[]" />
        </div>
        <div class="col">
          <input type="time" class="form-control" name="lun_mat1[]" />
        </div>
      </div>
    </div>
    <div class="col-sm-4 col-12">
      <label>Lundi après-midi </label>
      <div class="row">
        <div class="col">
          <input type="time" class="form-control" name="lun_ap1[]" />
        </div>
        <div class="col">
          <input type="time" class="form-control" name="lun_ap1[]" />
        </div>
      </div>
    </div>
    <div class="col-sm-4 col-12">
      <input type="checkbox" name="rememberMe"> Fermer
    </div>
  </div>
</section>

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 Elusive Solution: Why jQuery's .css() Method Fails

I am currently facing an issue with my code that utilizes the jQuery .css() method to modify the style of a specific DIV. Unfortunately, this approach does not work as expected. To illustrate the problem, I have provided a simplified version of my code bel ...

Is it possible to create a CSS grid with a varying number of columns?

I recently set up a webpage with a CSS grid that centers the main section at 80% width. <html> .... <body> <main> <section> </section> </main> </body> .... </html> main { display: grid; j ...

How to make sure that an element overflowing its container always starts from the top

My website has a section called <mat-drawer-container>, which contains a list of items called <mat-selection-list>. However, when the number of elements in the list exceeds the display height and scrolling is necessary, the scroll position star ...

jQuery Mobile Dialog Alert Box

Here's a code snippet that can be used to open a dialog box: <p><a href="ShopItems/Rotax125MicroMax.html" data-rel="dialog" data-role="button">Rotax 125 Micro Max</a></p> Next, we have a page whic ...

How can a JSON string be assigned to a variable for use in a Google pie chart?

I am currently experiencing an issue with my web server. I am sending a JSON object as an argument via render_template to my website, where I intend to use this data to display a Google pie chart. The problem arises when I try to assign the Google pie cha ...

Countdown Timer App using Flask

I'm currently working on a Flask-based game that involves countdown timers for each round. My goal is to have the timer decrease by 1 second every round without the need to reload the page. I've tried using time.sleep in my Python code to update ...

span element failed to trigger onload event

I'm encountering a basic issue with my code as a beginner. Below is the HTML snippet: <!DOCTYPE html> <html> <head> <meta http-equiv='content-type' content='text/html; charset=utf8' /> <scrip ...

The content is unclipped with a border-radius and hidden overflow

As I work on incorporating stylistic text inside rounded divs, I encounter a challenge where the text touches the top of the container. While I have successfully managed to customize various content elements such as nested divs and background images, this ...

Align text vertically next to an image

I am facing a challenge with aligning text vertically next to an image floated left. I have tried various solutions recommended on different platforms, but none seem to work for me. Despite following the suggestions provided in this particular solution, I ...

Is it possible to retrieve the complete file path in a form?

My goal is to retrieve a file using an input element of type "file". This element is located within a partial view, and I need to send it to the controller or request it there using "Request.Form["inputFile"];". However, this method only provides me with t ...

Guide to making a single row beneath two columns using CSS Grid

My goal is to utilize CSS Grid in order to design a blurb layout featuring 2 columns at the top and a full row below. This will allow for an FA Icon and Title, accompanied by a full description below, similar to the image provided. I believe I have succes ...

What is the best way to include start and end labels on Bootstrap's progress bars?

Is there a way to add start and end labels directly below the progress bar in Bootstrap? Here is an example of what I want: [||||||||------------] <Start Label> <End Label> I have been searching for a solution, but it seems ...

Is Consistency Possible with CSS Transition Direction?

Take a look at this example: https://codepen.io/jon424/pen/XWzGNLe In the provided code snippet, there is a button that can toggle the visibility of an image. When clicked, the image disappears from bottom to top and reappears when clicked again. The use ...

Utilize AJAX to dynamically refresh the page without having to reload it, enabling the use of both POST and GET methods

In order to avoid reloading the page when refreshing, I am utilizing Ajax for this particular 3-sided content along with JavaScript. Here is the code: Content: <ul id="nav"> <li><a href="ajax_adat.php?id=8&epul=0">Data</a>< ...

Align the items at the center of a Vue Router Link

I am looking to design a navigation bar that includes router-link items, with each item displaying an icon on the left side and text on the right side. An example of this design can be seen in the Firebase navigation bar. https://i.sstatic.net/eg328.png ...

What is the process for generating a GET request for selected checkboxes and subsequently showcasing the data on an HTML webpage?

Currently working on an app project and need assistance with implementing a feature. I have successfully set up a POST method for the checkboxes that are checked, but I am unsure how to retrieve this data and display it on my HTML page using a GET method ...

Tackling the sticky header problem with in-browser anchoring and CSS dynamic height restrictions

I am experimenting with a unique combination of a Pure CSS in-page anchoring solution using scroll-behavior: smooth and scroll-margin-top settings, along with a sticky header for in-page navigation. By utilizing IntersectionObserver, I can identify when t ...

What could be causing my jQuery $(this).next().removeAttribute to not function properly?

I am currently working on a file upload form that includes buttons like "Choose file", "Upload", and "Add other file". I am facing an issue where the "disabled" attribute is successfully removed from the first Upload button upon File Input change, but it ...

Is there a way to perfectly center text both vertically and horizontally to the right side of an image?

I'm working on developing a mobile website using jQuery Mobile and I want to include images in my "collapsible" elements. Here is the code I am using: <div data-role="collapsible" data-collapsed="true"> <h3><img src="image ...

The size of table cells automatically adjusts when zooming in the browser

While trying to display my table in Chrome, I noticed that the cell sizes of the table change when zooming in. Additionally, the table is rendered incorrectly in other browsers like IE and Firefox. I attempted adjusting the sizes to percentage values but i ...