是否有可能截断输入中的文本type="file",我的意思是,当我选择文件时,如果filename它太长应该是truncated.我尝试申请text-overflow: ellipsis;但没有任何改变.
如果width为输入指定了fixed ,则大多数浏览器应自行截断它.如果没有,你仍然可以使用,text-overflow: ellipsis但在使用它有两个额外的属性和宽度之前它不会有任何区别:
input[type=file] {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 150px;
}
Run Code Online (Sandbox Code Playgroud)