1

To have a customized input file, I've made it hidden by:

 input[type="file"]{display:none;}

and have put a background for its label:

 label.uploadfilelabel {background-image:url(../image.jpg);}

This approach works fine, But it has introduced another problem: Keyboard tab does not stop on this button and its label. I tried using tabindex="0" with no result. Is there any way to stop keyboard tab on this hidden button?

Of course, I prefer a pure CSS solution, but a javascript solution (without jQuery) is also acceptable.

Thanks for sharing

UPDATE: Here is a fiddle of the problem. I tested, It works in IE and FireFox but not in Chrome

Ormoz
  • 2,975
  • 10
  • 35
  • 50

1 Answers1

1

You should try this. It works, but keep in mind it is html5.

<input type="file" tabindex="-1">
Shawn
  • 51
  • 1