gpt4 book ai didi

html - 将文本放在 Bootstrap 输入旁边不起作用

转载 作者:行者123 更新时间:2023-11-28 15:11:43 25 4
gpt4 key购买 nike

所以我有一个表单,我正在使用 Bootstrap 框架,并且在这种表单的每个输入类型上,我都希望在左侧显示输入的文本,但文本在输入上方会发生什么,如下所示:

表格现在的样子: enter image description here

<div class="container">
<br>
<center> <h3> Jongere toevoegen </h3> </center>
<br>
<?php echo form_open('index.php/Addjongere/Add_jongere'); ?>
<form>
<div class="form-group row">
<label>Roepnaam:</label>
<input class="form-control" name="roepnaam" id="roepnaam" placeholder="Roepnaam" type="text">
</div>

<div class="form-group row">
<label>Tussenvoegsel:</label>
<input class="form-control" name="tussenvoegsel" id="tussenvoegsel" placeholder="Tussenvoegsel" type="text">
</div>

<div class="form-group row">
<label>Achternaam:</label>
<input class="form-control" name="achternaam" id="achternaam" placeholder="Achternaam" type="text">
</div>

<div>
<button class="btn btn-primary" name="Add_jongere" >Toevoegen</button>
</div>
</form>
</div>

有人知道我能做什么吗?感谢任何形式的帮助

最佳答案

这是你想要得到的吗?从您的表单中删除 class="form-inline" 并向您的表单组 div 添加类 row

我还在表单周围添加了一个容器以使其保持合适的大小。

编辑
我忘记将 class="col-sm-4" 添加到标签,将 class="form-control col-sm-8" 添加到输入。所以他们不挨着。

label{
text-align: center;
}

h3, .container button{
display: block;
margin: 0 auto;
text-align: center;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<div class="container">
<h3> Jongere toevoegen </h3>
<br>
<form>
<div class="form-group row">
<label class="col-sm-4">Roepnaam:</label>
<input class="form-control col-sm-8" name="roepnaam" id="roepnaam" placeholder="Roepnaam" type="text">
</div>

<div class="form-group row">
<label class="col-sm-4">Tussenvoegsel:</label>
<input class="form-control col-sm-8" name="tussenvoegsel" id="tussenvoegsel" placeholder="Tussenvoegsel" type="text">
</div>

<div class="form-group row">
<label class="col-sm-4">Achternaam:</label>
<input class="form-control col-sm-8" name="achternaam" id="achternaam" placeholder="Achternaam" type="text">
</div>

<div>
<button class="btn btn-primary" name="Add_jongere">Toevoegen</button>
</div>
</form>
</div>

关于html - 将文本放在 Bootstrap 输入旁边不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49644554/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com