Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何将输入(带标签)与同一行上的按钮对齐?_Html_Css_Twitter Bootstrap 3 - Fatal编程技术网

Html 如何将输入(带标签)与同一行上的按钮对齐?

Html 如何将输入(带标签)与同一行上的按钮对齐?,html,css,twitter-bootstrap-3,Html,Css,Twitter Bootstrap 3,只是尝试通过将所有元素内联来创建一个易于使用的搜索表单。看起来标签将输入向下推了大约14px,但是搜索按钮没有相同的操作。有没有办法让我的一切都在同一条线上 <div class="row"> <div class="col-md-2"> <label>Date: </label> <input type="date" name="startdate" class="form-control"/>

只是尝试通过将所有元素内联来创建一个易于使用的搜索表单。看起来标签将输入向下推了大约14px,但是搜索按钮没有相同的操作。有没有办法让我的一切都在同一条线上

<div class="row">
    <div class="col-md-2">
        <label>Date: </label>
        <input type="date" name="startdate" class="form-control"/>
    </div>
    <div class="col-md-2">
        <label>Optional Search String: </label>
        <input type="text" class="form-control"/>
    </div>
    <div class="col-md-2">
        <button type="button" class="btn btn-primary">Search</button>
    </div>
</div>


日期:
可选搜索字符串:
搜寻

我不相信有任何特定的引导类,但是使用按钮上的
边距顶部:14px
自己做很容易,我不相信有任何特定的引导类,但是自己做很容易,在按钮上使用
边距顶部:14px
一个技巧是在
按钮之前添加一个隐藏的
标签

<label class="hiddenLabel">This is hidden label</label>
<button type="button" class="btn btn-primary">Search</button>
这是隐藏标签
搜寻
然后可以应用
可见性:隐藏指向此隐藏标签


一个技巧是在
按钮之前添加一个隐藏的
标签

<label class="hiddenLabel">This is hidden label</label>
<button type="button" class="btn btn-primary">Search</button>
这是隐藏标签
搜寻
然后可以应用
可见性:隐藏指向此隐藏标签


日期:
可选搜索字符串:
搜寻

日期:
可选搜索字符串:
搜寻

您不需要使用任何技巧,bootstrap已经为这种场景提供了一个类。您可以在您的需求中使用它。我已经根据这个修改了你的课程

<div class="form-inline">
    <div class="form-group">
        <label>Date: </label>
        <input type="date" name="startdate" class="form-control"/>
    </div>
    <div class="form-group">
        <label>Optional Search String: </label>
        <input type="text" class="form-control"/>
    </div>
  <div class="form-group" style="vertical-align:bottom">
        <button type="button" class="btn btn-primary">Search</button>
  </div>
</div>

日期:
可选搜索字符串:
搜寻
我刚刚将
垂直对齐:bottom
与last
表单组一起使用,因为在最后一个组中只有一个元素,而不是剩下的两个元素


您不需要使用任何技巧,bootstrap已经为这种场景提供了一个类。您可以在您的需求中使用它。我已经根据这个修改了你的课程

<div class="form-inline">
    <div class="form-group">
        <label>Date: </label>
        <input type="date" name="startdate" class="form-control"/>
    </div>
    <div class="form-group">
        <label>Optional Search String: </label>
        <input type="text" class="form-control"/>
    </div>
  <div class="form-group" style="vertical-align:bottom">
        <button type="button" class="btn btn-primary">Search</button>
  </div>
</div>

日期:
可选搜索字符串:
搜寻
我刚刚将
垂直对齐:bottom
与last
表单组一起使用,因为在最后一个组中只有一个元素,而不是剩下的两个元素


这会将标签放在字段的左侧。我不认为这是解决原始问题的正确方法。这会将标签放在字段的左侧。我认为这不是解决最初问题的正确方法。