tags:

views:

3317

answers:

2

How to style the input type="file" button.

+1  A: 

the only way i can think of is to find the button with javascript after it gets rendered and assign a style to it

you might also look at this writeup

roman m
+2  A: 

Styling file inputs is notoriously difficult, as most browsers will not change the appearance from either css or javascript.

Even the size of the input will not respond to the likes of: <input type="file" style="width:200px">

Instead you will need to use the size attribute: <input type="file" size="60" />

For any styling more sophisticated than that (e.g. changing the look of the browse button) you will need to look at the tricksy approach of overlaying a styled button and input box on top of the native file input. The article already mentioned by rm at www.quirksmode.org/dom/inputfile.html is the best one I've seen.

Jonathan Moffatt