1

I am trying to set up my rails forms to have border-box using the following CSS. But it doesn't seem like the css is being applied to my fields and I am not sure why.

Note: I recently updated my app from Bootstrap 2.3 to Bootstrap 3.1. Not sure if this has any effect but I thought it was worth mentioning.

View

  <%= f.label :name %>
  <%= f.text_field :name %>

  <%= f.label :website %>
  <%= f.text_field :website %>

  <%= f.label :primary_field %>
  <%= f.select :primary_field, @primary_field %>

  <%= f.label :address %>
  <%= f.text_field :address, :placeholder => '123 Test St, City State Zip'%>

  <%= f.label :description %>
  <%= f.text_area :description, :size => "30x5" %>

  <%= f.submit "Add Company", class: "btn btn-large btn-primary" %>

CSS.SCSS File

@mixin box-sizing($box-model) {
  -webkit-box-sizing: $box-model; // Safari <= 5
     -moz-box-sizing: $box-model; // Firefox <= 19
          box-sizing: $box-model;
}

....

input, textarea, select, .uneditable-input, {
  border: 1px solid #bbb;
  width: 100%;
  margin-bottom: 15px;
  @include box-sizing(border-box);
}

Picture of the output These boxes should be bigger enter image description here

2
  • Is your CSS being loaded after any other vendor CSS? Commented Apr 19, 2014 at 19:24
  • I don't think so, all my css in is just in the custom.css.scss file that rails generates. Everything was working fine until I upgraded my bootstrap, now I am having trouble getting the padding on all these to work properly Commented Apr 19, 2014 at 19:25

1 Answer 1

1

Apparently there are changes you need to change in your CSS to make it work as before. Found this Migration guide from Bootstrap 2.x to 3.x. Try follow this guide.

Sign up to request clarification or add additional context in comments.

1 Comment

Ill take a dive into this when I get the chance later today, but at first glance, it looks really good!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.