发布网友
共3个回答
热心网友
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>定义html 中input file的样式</title>
<style type="text/css">
body {
font-size: 14px;
}
input {
vertical-align: middle;
margin: 0;
padding: 0
}
.file_style {
position: relative;
width: 340px
}
.text_style {
height: 22px;
border: 1px solid #cdcdcd;
width: 180px;
}
.button_style {
background-color: #FFF;
border: 1px solid #CDCDCD;
height: 24px;
width: 70px;
}
.file_item {
position: absolute;
top: 0;
right: 80px;
height: 24px;
filter: alpha(opacity : 0);
opacity: 0;
width: 260px
}
</style>
</head>
<body>
<div class="file_style">
<form action="" method="post" enctype="multipart/form-data">
<input type="text" name="textfield" id="textfield" class="text_style"/> <input
type="button" class="button_style" value="浏览..." /> <input type="file"
name="fileField" class="file_item" id="fileField" size="28"
onchange="document.getElementById('textfield').value=this.value" />
<input type="submit" name="submit" class="btn" value="上传" />
</form>
</div>
</body>
</html>
热心网友
可以用样式覆盖的
热心网友
不同的浏览器显示的不一样的哦。
不过可以自己改善一下