Previous Message
Next Message

styling input=file?

Sent by Andrew Clover on 23 February 2005 09:09


Theodore Serbinski [EMAIL-REMOVED]> wrote:

> Got a question, this code does not correctly style the <input
> type="file" />. Ideas?

You can't style an <input type="file" /> at all really. Browsers mostly 
ignore styles, and those they do apply are applied differently in 
different browsers.

You also can't create a JavaScript surrogate control, because IE is the 
only browser that allows you to open the Browse box programmatically, 
but even then if you do, it refuses to send the file when you submit the 
form.

The only successful strategy I have met for styling file uploads is to 
create a surrogate control, place the <input type="file" /> directly 
over it using CSS positioning, and then make the input effectively 
invisible using CSS opacity (the alpha filter in IE). And this still has 
the problem that you have to line up the positioning of the browse 
button in the surrogate, which will be different in every browser and 
there's no way to find out what it is.

To summarise: styling file uploads is scarcely possible, difficult to do 
compatibly and accessibly even then, and generally not worth the insane 
hassle.

To summarise the summary: aaarrrrgh.

-- 
Andrew Clover
[EMAIL-REMOVED]
http://www.doxdesk.com/
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: