您的位置:首页 > Web前端 > HTML5

html5-file样式

2015-04-07 16:27 429 查看
在复习html5,file时,偶然找到了一篇之前一直想实现的样式需求。贴代码如下,但还有两个问题不太懂。

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>上传文件</title>
</head>
<style type="text/css">
.fileInputContainer{
height:256px;
background:url(http://images.cnblogs.com/cnblogs_com/dreamback/437546/o_ff6.png);
position:relative;
width: 256px;
}
.fileInput{
height:256px;
overflow: hidden;
/*不太理解为什么要这样设置???*/
font-size: 300px;
position:absolute;
/*opacity=1时,为什么文字会消失?*/
right:0;
top:0;
opacity: 0;
filter:alpha(opacity=0);
cursor:pointer;
}
</style>
<body>
<div class="fileInputContainer">
<input class="fileInput" type="file" name="" id="" />
</div>
</body>
</html>


在chrome下结果



存在的问题:选择文件后,无法看到是否已经选择文件。

原文地址:/article/7045076.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: