如何使用 Bootstrap 4 使输入时间响应

How to make input time responsive using Bootstrap 4

我正在处理 laravel 项目,我需要使此表单响应,我添加了此 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 但没有任何改变 有什么建议么 ? 谢谢

这是表格:

  <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>

我认为您需要使用特定的 col 数字和断点来使您的代码具有响应性。已将 col-sm-4 col-12 添加到您的主要栏目。这意味着这个块将是宽度的 4/12,直到 Small (576px) bootstrap 宽度。然后它将是 12/12 宽度。更多关于 bootstrap 断点和 col 的信息 https://getbootstrap.com/docs/4.0/layout/grid/

尽管已将 class="form-control" 添加到您的 input 中。现在他们也响应了

<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>