Priyanka
Priyanka

Reputation: 2832

how to apply css to the input type file for setting width?

i want to set the width of the html tag . And also apply css on the browse button which is provided in the input type file.

I referred the following -

Is there a way to set width of for showing in Firefox?

also referred following-

Setting uniform width in all browsers

but it is for specific browser. It should work on the mozila firefox , netscape navigator, google crome,safari etc. and i don't want to hide the original input control.

how to do this?

Upvotes: 2

Views: 5993

Answers (2)

Guffa
Guffa

Reputation: 700402

You don't. It doesn't work that way.

You can specify the size of the element, but the browser chooses itself how to use that space to display the input field and the button. You can't style the intput field and the button separately.

It's not even specified in the standard that the file input should have an input box and a button. The browser can display the control any way it sees fit, and some browsers displays it differently, for example using a button and a text label.

Upvotes: 1

Nitzan Tomer
Nitzan Tomer

Reputation: 164177

The short answer is that you can not really style the input file, and it's like this by design. how ever, some tricks are available for you, for example: http://www.quirksmode.org/dom/inputfile.html

Upvotes: 1

Related Questions