bulma:水平表单控件未正确扩展

时间:2017-07-05 18:54:55

标签: html css bulma

我有一个文本输入和2个选择我想要将它们水平放置。基于bulma css框架,我应该做的事情:

<div class="field is-horizontal">
  <div class="field-body">
     <div class="field">
        <p class="control is-expanded has-icons-left">
           <input class="input" type="text" placeholder="Search" name="id" id="id">
           <span class="icon is-small is-left"><i class="fa fa-search"></i></span>
        </p>
     </div>
     <div class="field">
        <p class="control">
           <span class="select">
              <select name="status" id="status">
                 <option value="">Status:</option>
                 <option value="active">active</option>
                 <option value="pause">pause</option>
              </select>
           </span>
        </p>
     </div>
     <div class="field">
        <p class="control">
           <span class="select">
              <select name="limit" id="limit">
                 <option value="">Limits:</option>
                 <option value="10">10</option>
                 <option value="20">20</option>
              </select>
           </span>
        </p>
     </div>
  </div>

通常最后2个选择应该采用它们的实际宽度,第一个输入应该扩展,直到它占用可用空间,但这是我得到的:

enter image description here

2 个答案:

答案 0 :(得分:1)

is-narrow添加到您想要缩小的字段中:

<div class="field is-narrow">

工作示例:https://jsfiddle.net/wostex/ut4nedq2/

答案 1 :(得分:0)

您需要将control is-expandedselect is-fullwidth合并。

以下是一个例子:

&#13;
&#13;
@import url('https://cdnjs.cloudflare.com/ajax/libs/bulma/0.4.2/css/bulma.min.css');
&#13;
<div class="field is-horizontal">
  <div class="field-body">
     <div class="field">
        <p class="control is-expanded has-icons-left">
           <input class="input" type="text" placeholder="Search" name="id" id="id">
           <span class="icon is-small is-left"><i class="fa fa-search"></i></span>
        </p>
     </div>
     <div class="field">
        <p class="control is-expanded">
           <span class="select is-fullwidth">
              <select name="status" id="status">
                 <option value="">Status:</option>
                 <option value="active">active</option>
                 <option value="pause">pause</option>
              </select>
           </span>
        </p>
     </div>
     <div class="field">
        <p class="control is-expanded">
           <span class="select is-fullwidth">
              <select name="limit" id="limit">
                 <option value="">Limits:</option>
                 <option value="10">10</option>
                 <option value="20">20</option>
              </select>
           </span>
        </p>
     </div>
  </div>
&#13;
&#13;
&#13;