How change CSS style fo file_field_tag?


#1

Hello, All.

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

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

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

.button{
border: 0;
background: white;
color: darkgreen;
width: 300px;
height: 30px;
position: absolute;
}

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


#2

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…


#3

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”


#4

Try to do it with some css, like this:

MyTextHere

<%= 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{
cursor:pointer;
}

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