代码如下:
<html>
<head>
<style>
.centre_upload {
display: inline-block; /*块内连*/
text-decoration: underline; /*文字下划线*/
color: rgb(20,95,150); /*字体颜色*/
position: relative; /*相对定位*/
cursor: pointer; /*手型鼠标*/
vertical-align: middle; /*与对象中部对齐*/
}
.file {
position:absolute; /*绝对定位*/
display:inline-block; /*块内连*/
filter: Alpha(Opacity=0); /*通过滤镜设置透明度*/
opacity:0; /*设置透明度*/
top:0px; /*与对象的顶部距离*/
right:0px; /*与对象的右边距离*/
cursor:pointer; /*手型鼠标*/
}
</style>
</head>
<body>
<a class="centre_upload">点击上传<input type="file" class="file" /></a>
<body>
</html>