默认样式
修改后的样式
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>