Bulma CSS - 输入字段中的按钮

时间:2017-08-25 15:24:48

标签: html css bulma

我使用Bulma Framework,如何将Button移动到与输入字段相同的行?,它看起来输入字段是全宽

我的代码:

<div class="container">
<div class="field">
  <div class="control has-icons-left has-icons-right">
    <input type="text" class="input is-info is-large" placeholder="Input number in seconds">
    <span class="icon is-medium is-left">
      <i class="fa fa-futbol-o"></i>
    </span>
  </div>      
</div>
<a class="button is-info">GO</a>

结果Result image

3 个答案:

答案 0 :(得分:6)

http://bulma.io/documentation/form/general/#form-addons

如果您想要右侧的按钮而不是输入内部的按钮, 您可以使用has-addons类来“合并”控件(输入和按钮),如下所示:

<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.5.1/css/bulma.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="container">
  <div class="field has-addons">
    <div class="control has-icons-left">
      <input type="text" class="input is-info is-large" placeholder="Input number in seconds">
      <span class="icon is-medium is-left">
        <i class="fa fa-futbol-o"></i>
      </span>
    </div>
    <div class="control">
        <a class="button is-info is-large">GO</a>
    </div>
  </div>
</div>

答案 1 :(得分:0)

https://bulma.io/documentation/form/general/#form-addons

或者您只需要对字段进行分组,然后按钮添加&#34; is-grouped&#34; &#34;字段中的类&#34;元件。

&#13;
&#13;
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.0/css/bulma.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>

        <div class="field is-grouped">
            <div class="control has-icons-left has-icons-right is-expanded">
                <input type="text" class="input is-info is-large" placeholder="Input number in seconds">
                <span class="icon is-medium is-left">
                  <i class="fa fa-futbol-o"></i>
                </span>
            </div>
            <p class="control">
                <a class="button is-info is-large">GO</a>
            </p>
        </div>
&#13;
&#13;
&#13;

答案 2 :(得分:0)

在这里,如何使用宽度为100%的搜索输入以及右侧的按钮而没有任何空格(基本上是将user404和Sébastien的答案混合在一起)

<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.0/css/bulma.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>

<div class="field has-addons">
    <div class="control has-icons-left has-icons-right is-expanded">
        <input type="text" class="input is-info is-large" placeholder="Enter words to search">
        <span class="icon is-medium is-left">
          <i class="fa fa-pencil"></i>
        </span>
    </div>
    <p class="control">
        <a class="button is-info is-large">SEARCH</a>
    </p>
</div>