gpt4 book ai didi

html - 内联输入元素不使用整个宽度

转载 作者:太空宇宙 更新时间:2023-11-03 21:11:16 24 4
gpt4 key购买 nike

我试图让 3 个元素彼此相邻,使用表单的整个宽度。请参阅下面的屏幕截图和 Bootstrap 3 代码。

有人知道为什么输入元素不会调整以适应整个宽度吗?

编辑:添加了额外的代码。还有更多文字,因为我不允许发布大部分代码?还有更多文字,因为我不允许发布大部分代码?还有更多文字,因为我不允许发布大部分代码?还有更多文字,因为我不允许发布大部分代码?

screenshot

   

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<form class="form-horizontal" role="form" method="post" action="mmm.php">

<div class='container-fluid' style="padding: 8px;">
<div class='row'>
<div class='col-sm-12'>
<div class="input-group form-group">
<select id="ID" name="ID" class="form-control selectpicker"
data-live-search="true"
style="">
<option value='559'>(559)</option>

</select>

<span class="input-group-btn">
<button id="GPS" class="btn btn-primary" type="button" onclick="loadCoordinates()">
<span id="icon" class="glyphicon glyphicon-screenshot"></span></button>
</span>

</div>
</div>
</div>


<div class='row'>
<div class='col-sm-12'>
<div class="form-group">
<label for="dato" class="">When:</label>
<div class='input-group'>
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
<input type='text'
value='10.10.2017'
name="dato"
class="form-control"
id="datoPicker"
readonly/>

</div>
</div>
</div>
</div>

<div class='row'>
<div class='col-sm-12'>
<div class="form-group">
<div class="col-xs-4 form-group">
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
<input type='text'
value='07:00'
name="fraKlokken"
class="form-control fraTimepicker"
id="fraKlokkenPicker"
readonly>
</div>
</div>
<div class="col-xs-4 form-group">
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-arrow-right"></span></span>
<input type='text'
value='15:00'
name="tilKlokken"
class="form-control tilTimepicker"
id="tilKlokkenPicker"
readonly>
</div>
</div>
<div class="col-xs-4">
<select class="form-control" id="lunchSelect" name="lunsj">
<option value="0">No lunch</option>
<option value="30">30m lunch</option>
<option value="60">60m lunch</option>
</select>
</div>
</div>
</div>
</div>



<div class='row'>
<div class='col-sm-12'>
<div class="form-group">
<label class="control-label" for="kommentar">Comment:</label>

<textarea class="form-control input" id="kommentar" name="kommentar"
placeholder="."
></textarea>
</div>
</div>
</div>



<div class='row '>
<div class='col-sm-12'>
<div class="form-group">
<label for="timearbeid">m,n,mn</label>
<div class="btn-group" data-toggle="buttons">
<label class="btn">
<input type="radio"
value="1"
required ><i
class="fa fa-circle-o fa-2x"></i><i class="fa fa-check-circle-o fa-2x"></i><span> Yes</span>
</label>

<label class="btn">
<input type="radio" class=""
value="0" >
<i class="fa fa-circle-o fa-2x"></i><i class="fa fa-check-circle-o fa-2x"></i><span> No</span>
</label>
</div>
</div>
</div>
</div>

最佳答案

您正在使用表单组类两次。将它从内部类中移除就可以了

   

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<form class="form-horizontal" role="form" method="post" action="mmm.php">

<div class='container-fluid' style="padding: 8px;">
<div class='row'>
<div class='col-sm-12'>
<div class="input-group form-group">
<select id="ID" name="ID" class="form-control selectpicker"
data-live-search="true"
style="">
<option value='559'>(559)</option>

</select>

<span class="input-group-btn">
<button id="GPS" class="btn btn-primary" type="button" onclick="loadCoordinates()">
<span id="icon" class="glyphicon glyphicon-screenshot"></span></button>
</span>

</div>
</div>
</div>


<div class='row'>
<div class='col-sm-12'>
<div class="form-group">
<label for="dato" class="">When:</label>
<div class='input-group'>
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
<input type='text'
value='10.10.2017'
name="dato"
class="form-control"
id="datoPicker"
readonly/>

</div>
</div>
</div>
</div>

<div class='row'>
<div class='col-sm-12'>
<div class="form-group">
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
<input type='text'
value='07:00'
name="fraKlokken"
class="form-control fraTimepicker"
id="fraKlokkenPicker"
readonly>
</div>
</div>
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-arrow-right"></span></span>
<input type='text'
value='15:00'
name="tilKlokken"
class="form-control tilTimepicker"
id="tilKlokkenPicker"
readonly>
</div>
</div>
<div class="col-xs-4">
<select class="form-control" id="lunchSelect" name="lunsj">
<option value="0">No lunch</option>
<option value="30">30m lunch</option>
<option value="60">60m lunch</option>
</select>
</div>
</div>
</div>
</div>



<div class='row'>
<div class='col-sm-12'>
<div class="form-group">
<label class="control-label" for="kommentar">Comment:</label>

<textarea class="form-control input" id="kommentar" name="kommentar"
placeholder="."
></textarea>
</div>
</div>
</div>



<div class='row '>
<div class='col-sm-12'>
<div class="form-group">
<label for="timearbeid">m,n,mn</label>
<div class="btn-group" data-toggle="buttons">
<label class="btn">
<input type="radio"
value="1"
required ><i
class="fa fa-circle-o fa-2x"></i><i class="fa fa-check-circle-o fa-2x"></i><span> Yes</span>
</label>

<label class="btn">
<input type="radio" class=""
value="0" >
<i class="fa fa-circle-o fa-2x"></i><i class="fa fa-check-circle-o fa-2x"></i><span> No</span>
</label>
</div>
</div>
</div>
</div>

您会在上面的代码片段中注意到另一件事,即每边仍有一些空间,这是由于 class='col-sm-12'class 一起使用造成的='col-xs-4'。删除它也会使您与 10.10.2017 值输入字段对齐。

   

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<form class="form-horizontal" role="form" method="post" action="mmm.php">

<div class='container-fluid' style="padding: 8px;">
<div class='row'>
<div class='col-sm-12'>
<div class="input-group form-group">
<select id="ID" name="ID" class="form-control selectpicker"
data-live-search="true"
style="">
<option value='559'>(559)</option>

</select>

<span class="input-group-btn">
<button id="GPS" class="btn btn-primary" type="button" onclick="loadCoordinates()">
<span id="icon" class="glyphicon glyphicon-screenshot"></span></button>
</span>

</div>
</div>
</div>


<div class='row'>
<div class='col-sm-12'>
<div class="form-group">
<label for="dato" class="">When:</label>
<div class='input-group'>
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
<input type='text'
value='10.10.2017'
name="dato"
class="form-control"
id="datoPicker"
readonly/>

</div>
</div>
</div>
</div>

<div class='row'>

<div class="form-group">
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
<input type='text'
value='07:00'
name="fraKlokken"
class="form-control fraTimepicker"
id="fraKlokkenPicker"
readonly>
</div>
</div>
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-arrow-right"></span></span>
<input type='text'
value='15:00'
name="tilKlokken"
class="form-control tilTimepicker"
id="tilKlokkenPicker"
readonly>
</div>
</div>
<div class="col-xs-4">
<select class="form-control" id="lunchSelect" name="lunsj">
<option value="0">No lunch</option>
<option value="30">30m lunch</option>
<option value="60">60m lunch</option>
</select>
</div>
</div>

</div>



<div class='row'>
<div class='col-sm-12'>
<div class="form-group">
<label class="control-label" for="kommentar">Comment:</label>

<textarea class="form-control input" id="kommentar" name="kommentar"
placeholder="."
></textarea>
</div>
</div>
</div>



<div class='row '>
<div class='col-sm-12'>
<div class="form-group">
<label for="timearbeid">m,n,mn</label>
<div class="btn-group" data-toggle="buttons">
<label class="btn">
<input type="radio"
value="1"
required ><i
class="fa fa-circle-o fa-2x"></i><i class="fa fa-check-circle-o fa-2x"></i><span> Yes</span>
</label>

<label class="btn">
<input type="radio" class=""
value="0" >
<i class="fa fa-circle-o fa-2x"></i><i class="fa fa-check-circle-o fa-2x"></i><span> No</span>
</label>
</div>
</div>
</div>
</div>

关于html - 内联输入元素不使用整个宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46664840/

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