[英]How to make HTML form input fields responsive without using Bootstrap
[英]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)引導寬度。 然后它將我們 12/12 寬度。 更多關於引導斷點和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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.