I have two applications for rails, and "form-horizontal" works in one, but not in the other, and I have no idea why.
The first application is called "Horizontal" (my test application), and the other is "Inventory"
Form in the "horizontal" application:
<%= simple_form_for(@part, html: {class: 'form-horizontal' }) do |f| %> <div class="field"> <%= f.input :name %> </div> <div class="field"> <%= f.input :number %> </div> <div class="actions"> <%= f.submit %> </div> <% end %>
and it looks like this in a browser:

and the form for the inventory application:
<%= simple_form_for(@item, html: {class: 'form-horizontal' }) do |f| %> <%= f.error_notification %> <div class="field"> <%= f.input :part_number %> </div> <div class="field"> <%= f.input :on_order_qty %> <%= f.input :revision %> <%= f.input :current_rev %> <%= f.input :name, required: false%><br> </div> <%= f.simple_fields_for :parts do |part| %> <%= render 'part_fields', :f => part %> <% end %> <div class="links"> <%= link_to_add_association 'Add additional supplier', f, :parts %><br><br> </div> <div class="fields"> <%= f.input :stock_qty %> <%= f.input :ncmr_qty %> </div> <div class="form-actions"> <%= f.submit %> </div> <% end %>
but in the browser it looks like this:

Why is there no form-horizontal class in the Inventory application?
It looks like the complete input fields are horizontal, but something strange is happening in the text input fields. Here is the html source from the browser for the Inventory application:
<form accept-charset="UTF-8" action="/items" class="simple_form form-horizontal" id="new_item" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="H3DKGhGdtfv1e8F1rg9TgDJUyaBspXOSFMpm2gnjwzk=" /></div> <div class="field"> <div class="input string required item_part_number"><label class="string required" for="item_part_number"><abbr title="required">*</abbr> Part number</label><input aria required="true" class="string required" id="item_part_number" maxlength="255" name="item[part_number]" required="required" size="255" type="text" /></div> </div> <div class="field"> <div class="input integer optional item_on_order_qty"><label class="integer optional" for="item_on_order_qty">On order qty</label><input class="numeric integer optional" id="item_on_order_qty" name="item[on_order_qty]" step="1" type="number" /></div> <div class="input string optional item_revision"><label class="string optional" for="item_revision">Revision</label><input class="string optional" id="item_revision" maxlength="255" name="item[revision]" size="255" type="text" /></div> <div class="input boolean optional item_current_rev"><input name="item[current_rev]" type="hidden" value="0" /><input class="boolean optional" id="item_current_rev" name="item[current_rev]" type="checkbox" value="1" /><label class="boolean optional" for="item_current_rev">Current rev</label></div> <div class="input string optional item_name"><label class="string optional" for="item_name">Name</label><input class="string optional" id="item_name" maxlength="255" name="item[name]" size="255" type="text" /></div><br> </div> ( I took out the html for the nested fields and some other fields for brevity) <div class="form-actions"> <input name="commit" type="submit" value="Create Item" /> </div> </form>
I tested in both Chrome and Firefox. I checked that the bootstrap-sass and simple_form gem are the same versions. I don't have an attractive CSS or javascript setting, just the @import 'bootstrap'; in the bootstrap_custom.css.scss file in both applications. I donβt know why the text input fields cover the entire screen width in the Inventory application, but the whole fields seem accurate and are displayed horizontally. What is wrong here?