重新排列Formtastic布局

时间:2010-11-16 14:27:57

标签: ruby-on-rails css formtastic stylesheet

对于CSS和样式表,我完全不熟悉并且非常缺乏经验。

我正在尝试重新排列布局,使其看起来像这张图片的底部: http://img242.imageshack.us/img242/3971/layoutiy.jpg 正如你所看到的,我设法让下拉菜单很好地对齐,但不是费用/顾问时间。

这是我的.erb文件;

<div id="defaults">
    <% semantic_form_for <more stuff goes here> %>
    ......
    <div id="customer-details">
        <%= form.input :fee %>
        <%= form.input :consultant_hours %>

        <%= form.input :automatic_prolonging, :as => :radio, :collection => [[("Yes"), "true" ]] + [[("No"), 'false']], :wrapper_html => { :class => "compact" } %>
        <%= form.input :customer_segment, :as => :radio, :collection => [[("Industry"), "Industry" ]] +[[("Bank/Finance"), "Bank/Finance" ]] + [[("Products/Services"), 'Products/Services']]+ [[("Organization"), 'Organization']]+[[("Other"), 'Other']], :wrapper_html => { :class => "compact" } %>
    </div>
    <% end %>

我编辑了我的formtastic_changes.css文件,如下所示:

#customer-details li{
    clear: none;
    float: left;
    padding: 0;
    height: 60px;
    margin-right: 40px;
}

#customer-details .compact ol li, #social-post-defaults .compact ol li,
#customer-details .compact ol, #social-post-defaults .compact ol {
    width: 220px !important; 
    height: auto !important;
}

#customer-details .compactSelect, #social-post-defaults .compactSelect {
    width: 160px !important;
}

#customer-details .compactSelect ol, #social-post-defaults .compactSelect ol {
    width: 220px !important;
}

#customer-details .compactSelect .field, 
#social-post-defaults .compactSelect .field {
    width: 146px !important;
}

#customer-details .compactSelect ol li, 
#social-post-defaults .compactSelect ol li {
    width: 160px;
    height: auto !important;
    white-space: nowrap;
}

#customer-details .string input {
    width: 285px;
    margin: 2px 0 5px;
    padding: 2px;
    font-size: 13px;
}

这就是问题所在。无论我更改宽度属性多少,都没有变化。 如果我删除“.string”,则宽度更改起作用,但字段仍然不会彼此相邻,而是彼此上下相互对齐。

我已经观看了关于轨道广播的Formtastic教程,并查看了formtastic Rdoc,但我似乎仍然无法解决这个问题。

有人能把我推向正确的方向吗? 感谢任何帮助。

1 个答案:

答案 0 :(得分:2)

@Emil:试试

#customer-details input {
    float: left;
    font-size: 13px;
    margin: 2px 0 5px;
    padding: 2px;
    width: 285px;
}
相关问题