How change CSS style fo file_field_tag?


Hello, All.

How change CSS style for <%= file_field_tag …> to watching in text

For example, <%= submit_tag …> happened change style:

<%= submit_tag "Upload", :class => "button" %>

border: 0;
background: white;
color: darkgreen;
width: 300px;
height: 30px;
position: absolute;

Maybe possibly do it for <%= file_field_tag …> ?
Thank you.


You already has your answer:

<%= submit_tag “Upload”, :class => “button” %>

There you have the class “button” , if you want to change the style, you
must change the css code…

Or maybe I didn’t understand your question…


Hello Andres. Thank you for answers!

On image it is seen, button “Upload” changed CSS style, but button
“Choose File” remained unchanged.

Both are used :class => “button”


Try to do it with some css, like this:


<%= f.file_field :image_url, id:“file-input” %>

And then in .css file pt something like this:

.image-upload > input
display: none;
.image-upload > label{

I haven’t tested this, but I think it could works…