1

CSS とスタイルシートに関しては、私は formtastic にまったく慣れておらず、かなり経験がありません。

この図の下部のようにレイアウトを再配置しようとしています。 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;
}

そして、これが問題です。width 属性をいくら変更しても、何も変わりません。「.string」を削除すると、幅の変更は機能しますが、フィールドは互いに隣り合っていませんが、互いに上/下に配置されています。

Railcast の Formtastic チュートリアルと Formtastic Rdoc の両方を見てきましたが、まだこの問題を解決できないようです。

誰かが私を正しい方向に向けることができますか? 助けてくれてありがとう。

4

1 に答える 1

2

@Emil: やってみる

#customer-details input {
    float: left;
    font-size: 13px;
    margin: 2px 0 5px;
    padding: 2px;
    width: 285px;
}
于 2010-11-16T14:43:13.153 に答える