css - 具有输入组的响应式网格

标签 css twitter-bootstrap

我怎样才能让它响应(让输入流畅地填充整个空间):

请记住,我还需要 inputgroups 和 inputs slim! Input-group-btn width: 0 是一个(可能并不完美)把输入放在一起的技巧。

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
  <div class="row">

  <div class="col-md-6 col-xs-12">
    
 <div class="input-group">
     <label>Strasse</label>
  <input type="text" class="form-control" value="strasse" />
  
     
  <span class="input-group-btn" style="width:0px;"></span>
  <label>PLZ</label>
        <input type="text" class="form-control" value="plz" style="margin-left:-1px" /></div>
      
      
  </div>
  <div class="col-md-6 col-xs-12">
      
 <div class="input-group">
    <label>Zimmer</label>
    <select class="form-control input-sm" ><option>ha</option><option>hi</option></select>
  <span class="input-group-btn" style="width:0px;"></span>
    <label>Etage</label>
    <select class="form-control input-sm" ><option>ha</option><option>hi</option></select>
    <span class="input-group-btn" style="width:0px;"></span>
    <label>Lift</label>
    <select class="form-control input-sm" ><option>ha</option><option>hi</option></select>
</div>      
      
          </div> <!-- end form-group -->
      
      
  </div>

您可以通过最小化和调整浏览器窗口大小来进行检查。

最佳答案

也许你应该做的是将输入类型包装在 col 中,

使用片段代码:

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
   <div class="container">
   <div class="row">

  
    
 <div class="input-group">
<div class="col-md-6 col-xs-12" style="padding:0;">
     <label>Strasse</label>
  <input type="text" class="form-control" value="strasse" />
  </div>
  <div class="col-md-6 col-xs-12" style="padding:0;">
     
  <span class="input-group-btn" style="width:0px;"></span>
  <label>PLZ</label>
        <input type="text" class="form-control" value="plz" style="margin-left:-1px" /></div>
      
      


<div class="col-md-4 col-xs-4" style="padding:0;">
   <label>Zimmer</label>
    <select class="form-control input-sm" ><option>ha</option><option>hi</option></select>
  <span class="input-group-btn" style="width:0px;"></span>
</div>
<div class="col-md-4 col-xs-4" style="padding:0;">
    <label>Etage</label>
    <select class="form-control input-sm" ><option>ha</option><option>hi</option></select>
    <span class="input-group-btn" style="width:0px;"></span>
</div>
 <div class="col-md-4 col-xs-4" style="padding:0;">
    <label>Lift</label>
    <select class="form-control input-sm" ><option>ha</option><option>hi</option></select>
</div>   
          </div> <!-- end form-group -->
      
      
  </div>
</div>

编辑:硬编码 style="padding:0;" 以覆盖默认 CSS

关于css - 具有输入组的响应式网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30313495/

相关文章:

html - 语义用户界面 : how to place an button at the bottom of a column?

javascript - 是否可以像 Jquery Elastic 插件一样使 div 随 textarea 一起增长?

javascript - P 标签没有更新

css - 使用 SVG 符号隐藏渐变

html - 崩溃时如何在 "gutter space"网格 div 之间维护 "responsive"?

html - 如何在 flex 显示中使文本直接对齐在 h4 下?

javascript - 将 Bootstrap 默认按钮更改为当前面板

javascript - 如何替换 div id 中的类名?

javascript - Bootstrap 表 : is it possible to call the function which sorts rows by column from code (without clicking the header)

javascript - 带有工具提示的 id base anchor 滚动链接