Beautification of input[type="file"] tag
1.1 Ideas
Use <input type="text"> and <input type="button"> to complete the text display (button) of Input[type="file"] and the display of the uploaded file path (function of the text input box) .
1.2 Examples
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Modify the default file upload button</title> <style> input{ padding: 0; } input[type="text"]{ float: left; height: 26px; border:1px solid #ccc; } input[type="button"]{ float: left; width:60px; height: 28px; border:1px solid #ccc; line-height: 28px; } input[type="file"]{ display:none; } </style> </head> <body> <div class="ipt-list"> <input type="text" name="upfile" id="upfile" readonly> <input type="button" value="上传" onclick="path.click()"> <input type="file" id="path" onchange="upfile.value=this.value"> </div> </body> </html>