Styling input type=file not working as expected

后端 未结 2 940
小鲜肉
小鲜肉 2021-01-21 11:49

I\'m creating a css template for form types and want to give form inputs a rounded border. This works well with type=text but doesn\'t work with type=file (for file upload).

2条回答
  •  借酒劲吻你
    2021-01-21 12:27

    Unfortunately, it's impossible to style a file upload input, besides changing the width a little bit. Browsers just don't allow any other change. If you want to style your file upload input, you'll have to use a nasty hack like placing an almost invisible file upload input on top of an image (which only works in some browsers), or a JavaScript solution like ajax-upload.

提交回复
热议问题