Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting uniform <input type="file"> width in all browsers

What combination of CSS or attributes are needed?

like image 866
Larsenal Avatar asked Nov 06 '08 17:11

Larsenal


People also ask

How do you write input type to width?

This can be done by using the size attribute or by width attribute to set the width of an element. The size attribute works with the following input types: text, search, tel, url, email, and password and not on type date, image, time for these we can use width attribute. Create a div in which we are putting our input.

What is the default width of input?

The width will be the value of the size attribute in characters that the input will display. Value should be an integer greater than zero. When not defined, the width of most input elements defaults to 20.

What is the default size of the text input field?

The default size for a text field is around 13 characters.


2 Answers

  • Hide the actual control
  • Made a DIV with the controls and styling you want on top of it

The button is not a standard HTML control.

See: http://www.quirksmode.org/dom/inputfile.html

like image 142
Diodeus - James MacFarlane Avatar answered Sep 22 '22 08:09

Diodeus - James MacFarlane


what's wrong with

<input type="file" size="50" .... /> 

? Will look same except safari on mac i guess (on mac, all upload controls looks different, on all browsers)

like image 33
Ionuț Staicu Avatar answered Sep 19 '22 08:09

Ionuț Staicu