繁体   English   中英

simple_form无法内联对齐2个集合选择

[英]simple_form cannot inline align 2 collection selects

如何在simple_form中对齐2个集合的下拉列表并使它们内联[drop 1] [drop 2]

上的示例:

http://simple-form-bootstrap.plataformatec.com.br/articles/new

显示如何对齐复选框和radiobuttion,但是无论如何我都尝试彼此内联对齐2个集合下拉列表,即时消息都无法执行。

尝试了所有我可以在这里找到的解决方案,并在线使用了包装内联器,类内联器等。

= f.input :age_from,
            :collection => 18..60,
            :selected => 18,
            :label => 'Age from',
            :style => "width: 85px !important"

  = f.input :age_to,
            :collection => 18..60,
            :selected => 55,
            :label => 'Age to',
            :style => "width: 85px !important"

HTML:

        <form accept-charset="UTF-8" action="/sessions" class="simple_form form-horizontal" id="new_session" method="post" novalidate><div style="margin:0;padding:0;display:inline"></div>
          <div class="control-group select required"><div class="controls"></div></div>
          <div class='ruler'></div>
          <div class="control-group select optional"><label class="select optional control-label" for="session_age_from">Age from</label><div class="controls"><select class="select optional" id="session_age_from" name="session[age_from]"><option value="18" selected="selected">18</option>

          <option value="60">60</option></select></div></div>
          <div class="control-group select optional"><label class="select optional control-label" for="session_age_to">Age to</label><div class="controls"><select class="select optional" id="session_age_to" name="session[age_to]"><option value="18">18</option>

          <option value="55" selected="selected">55</option>
          <option value="60">60</option></select></div></div>
          <div class='ruler'></div>
          <div class="control-group string optional"></div>
        </form>

CSS:

.form-search input, .form-search textarea, .form-search select, .form-search .help-inline, .form-search .uneditable-input, .form-search .input-prepend, .form-search .input-append, .form-inline input, .form-inline textarea, .form-inline select, .form-inline .help-inline, .form-inline .uneditable-input, .form-inline .input-prepend, .form-inline .input-append, .form-horizontal input, .form-horizontal textarea, .form-horizontal select, .form-horizontal .help-inline, .form-horizontal .uneditable-input, .form-horizontal .input-prepend, .form-horizontal .input-append {
    display: inline-block;
    margin-bottom: 0;
    vertical-align: middle;
}
select {
    background-color: #FFFFFF;
    border-style: solid;
    border-width: 1px;
}
select {
    margin: 0.5em 0;
}
select {
    background-color: #FFFFFF;
    border: 1px solid #BBBBBB;
    width: 220px;
}
select, input[type="file"] {
    height: 30px;
    line-height: 30px;
}
select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {
    border-radius: 3px 3px 3px 3px;
    color: #555555;
    display: inline-block;
    font-size: 14px;
    height: 20px;
    line-height: 20px;
    margin-bottom: 9px;
    padding: 4px 6px;
}
input, button, select, textarea {
    font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}
label, input, button, select, textarea {
    font-size: 14px;
    font-weight: normal;
    line-height: 20px;
}
button, input, select, textarea {
    font-size: 100%;
    margin: 0;
    vertical-align: middle;
}

一种选择是仅使用引导布局div标签,以使其对齐。 我使用span3 BC,我的总格式为span6,但是您可以根据需要进行修改。

<div class="row">
    <div class="span3"><%= f.input :age_from, :collection => 18..60, :selected => 18, :label => 'Age from', :style => "width: 85px !important" %></div>
    <div class="span3"><%= f.input :age_to, :collection => 18..60, :selected => 55, :label => 'Age to', :style => "width: 85px !important" %></div>
</div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM