1

I have a form_for in my rails app. I just figured out how to override bootstrap css on input text fields. but I dont know how to override the css on input text area

Okay so this is how I change the natural styling of my text field.

CSS

.product-form input[type="text"] {
  height: 26px;
  border: 0px ;
 }

Haml form_for

  %span.product-form
    = f.text_field :name, placeholder: "Name" 

However this doesn't work on text area = f.text_area :description

Any ideas?

1 Answer 1

2

A textarea tag is a separate type of tag from an input tag with type text. You'll need to style the textarea separately. If you want the same styling as your input field, you can just add it:

.product-form input[type="text"], .product-form textarea {
  height: 26px;
  border: 0px ;
}

You might not want to style textareas the same as text inputs, though, as the elements do function differently.

One thing to get used to, when doing CSS work, is using the developer tools provided by your browser to troubleshoot problems like this. When you're trying to style an element and it isn't taking, right click that element and click 'Inspect Element' (assuming Firefox or Chrome), which will help you figure out answers to these kind of questions yourself.

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

1 Comment

I tried to trouble shoot it like that it's just that boostrap is so dense and literally some of the css classes are called .uneditable-field lol either way thank you!

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.