html - CSS - 为什么文件上传控件不遵循 CSS 宽度规则?

标签 html css forms

我有以下 HTML 代码:

<input type='file' class="" maxlength="96" size="16" value="" name='headshot' id='headshot' style="width:21.5em;"/>

似乎“大小”值控制“爆头”的实际宽度而不是 CSS。 为了使它成为理想的宽度,我必须使用以下代码:

<input type='file' class="" maxlength="96" size="32" value="" name='headshot' id='headshot' style="width:21.5em;"/>

你知道为什么 CSS 在这里不起作用吗?我已经在 Firefox 3.6.8 中测试了上面的代码。

谢谢

最佳答案

Fortunately, reader Michael McGrady invented a very neat trick that allows us to (more or less) style file upload fields

参见此处:http://www.quirksmode.org/dom/inputfile.html

关于html - CSS - 为什么文件上传控件不遵循 CSS 宽度规则?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3349846/

相关文章:

javascript - 按 Enter 键并有多个提交按钮

javascript - 应用多个类不能正常工作

javascript - 使用 prev 和 next 动画 CSS3 旋转 onclick

html - 旋转的文本呈现效果不佳

php - 图像不会添加到 SQL 数据库

forms - Angular 2 : Can't bind to 'ngModel' since it isn't a known property of 'input'

javascript - 如果选中则禁用表单(多表单)

html - JavaFX Web View : link to anchor in document doesn't work using loadContent()

html - 使用 Bootstrap 4 一个一个地折叠导航栏元素

html - 内部有图像的 w3-cell 元素不会调整到等高