Forum: Ruby on Rails How change CSS style fo file_field_tag?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Artemiy B. (Guest)
on 2017-02-07 23:08
Hello, All.

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

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

<div class="actions">
  <%= 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.
Andres C. (Guest)
on 2017-02-28 19:07
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...
Artemiy B. (Guest)
on 2017-03-02 20:49
Attachment: FileToUpload.png (0 Bytes)
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"
Andres C. (Guest)
on 2017-03-02 23:30
Try to do it with some css, like this:

<div class="image-upload">
   <label for="file-input">
     <span> MyTextHere</span>

   <%= 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...
This topic is locked and can not be replied to.