HTML File upload field style(HTML 文件上传字段样式)
问题描述
我正在尝试创建一个有点风格的文件上传字段,但我似乎在查找此类示例时遇到了问题.我知道部分原因是字段本身因浏览器而异.
I am trying to create a file upload field that has a little bit of style to it, but I seem to be having problems finding examples of this. I know part of the reason is that the field itself varies from browser to browser.
任何想法如何做到这一点?或者有没有办法在不使用可以设置样式的表单的文件元素的情况下做到这一点?
Any ideas how to do this? Or is there a way to do this without using a file element of a form that can be styled?
推荐答案
如果您的意思是文件名的文本字段,您可以在 css 文件中使用 input[type=file] 选择器.例如:
If what you mean is the text field for the file names, you can use the input[type=file] selector in the css files. For example :
input[type=file] { background-color: red; }
如果您的意思是文件选择对话框,我认为它取决于浏览器/操作系统,您几乎无能为力(如果有的话).
If what you mean is the file selection dialog box, I think it's browser/OS dependent and there's little (if any) you can do about it.
这篇关于HTML 文件上传字段样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!