默认样式
文章来源:https://www.toymoban.com/news/detail-587592.html
修改后的样式
文章来源地址https://www.toymoban.com/news/detail-587592.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>type:file</title>
<style>
.inputFile{
/* 隐藏按钮后的文字 */
font-size: 0;
}
/* 修改按钮后的文字颜色 */
.inputFile[type="file"] {
color: gray;
}
.inputFile::file-selector-button {
height: 3rem;
font-size: 1rem;
color: #fff;
border-radius: .25rem;
border: 1px solid #f14a24;
padding: .75rem 1rem;
background-color: #f14a24;
box-sizing: border-box;
font-family: inherit;
cursor: pointer;
}
</style>
</head>
<body>
<input type="file" class="inputFile">
</body>
</html>
到了这里,关于CSS ::file-selector-button伪元素修改input上传文件按钮的样式的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!