代碼如下:
<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>