In fact, the input width on the left needs to be 100%-30, and the width on the right is always 30
js can do it, I don’t know css
I did it myself:
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>input type="file"</title> <style type="text/css"> body{ font-size:14px;} input{ vertical-align:middle; margin:0; padding:0} .file-box{width:100%} .txt{ position:absolute; height:22px; border:1px solid #cdcdcd;left:10px;right:100px} .btn{ position:absolute; background-color:#FFF; border:1px solid #CDCDCD;height:24px; width:70px;right:20px} </style></head><body> <div class="file-box"> <form action="" method="post" enctype="multipart/form-data"> <input type='text' name='textfield' id='textfield' class='txt' /> <input type='button' class='btn' value='浏览' /> </form> </div></body></htm>