Styling input type=file not working as expected

后端 未结 2 937
小鲜肉
小鲜肉 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:17

    According to the first Google search result, it's rather involved. See this article on quirksmode.org for information on how to do it.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题