Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9057935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:35:33+00:00 2026-06-16T14:35:33+00:00

I use the simple-form gem in a rails 3.1 project together with twitter bootstrap.

  • 0

I use the simple-form gem in a rails 3.1 project together with twitter bootstrap. I have several form views which all look fine. But now I like to style the text input field in one of the forms so it gets a bit smaller. The text input field is located in the edit form view of one of my controllers called “roles”. The partial for the form looks like this:

= simple_form_for @role, :html => { :class => 'form-horizontal' } do |f| 
  = f.error_notification
  = f.input :name
  = f.input :description
  .form-actions
    = f.button :submit, :class => 'btn-primary'
    = link_to t('.cancel', :default => t("helpers.links.cancel")), roles_path, :class => 'btn'

There is a style file under:


app/assets/stylesheets/roles.css.scss

which was created with the scaffold command. I tried to put some styling in here but this results in a change in every form of my application. Is there a good way to change the styling of a text input field only for one special form view with simple form? Where should I put the styling and how would the styling look like if I’d like to have the input text field in the size: width 100px to height 50px?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T14:35:34+00:00Added an answer on June 16, 2026 at 2:35 pm

    You need to know that even if you have a special CSS file just for roles. In the end, every CSS file is bundled up and served together. This means, that roles.css will be loaded on every page, which results in the behavior you described.

    If you want to style a single form, you can do this by adding a class:

    = simple_form_for @role, :html => { :class => 'form-horizontal roles-form' } do |f| 
    

    Now you can scope your CSS definitions to .roles-form and they will only apply to this single form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the i18n feature of simple form, which works great in
I have a form in simple HTML and does not use strut tags. When
After reading the answer which suggested I use Simple_form gem with bootstrap integration, I
I have simple form. I want to use jquery to prevent form submit. $(document).ready(function()
We have a very simple use of datepicker in rails 3.1.3 app with jquery.
My app is a simple form. I use TableLayout , and have a lot
i want to use facebook's fb:dialog tag to display a simple pop-up form for
I use ckeditor in admin panel but in user submit form use simple textbox
I have a Rails application with a public REST API which authenticates API clients
I have a web service to which I send a xml request (application/x-www-form-urlencoded encoded)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.