6

How can i customize the file field "Browse" button in ruby on rails. cutomise in sense i want to change the button color and style. Is this possible in ROR? If so , can any one help me out ....

  • 1
    That's not specific to Rails, it's part of the browser. I don't know how to customize it, but try tagging your question with CSS - you may get more responses. – Jarrod Jul 08 '09 at 18:16

1 Answers1

2

All Rails' file_field helper does is make it easier to create a file input, rather than having to code HTML directly (ie. <input type="file" ...>). Unfortunately, the file input is not very styleable, and the button especially tends to be stuck to the way the browser defines it should look.

However, there are some techniques/hacks for tricking the browser into making the browse button look how you want it, by making use of CSS and Javascript. You can take a look at an article about it on quirksmode. However, as this makes use of the CSS opacity property, the input will not look right in browsers that do not support it. As well, there are some other problems with this approach, as outlined in the article.

Daniel Vandersluis
  • 91,582
  • 23
  • 169
  • 153