表单元素美化之fils美化
2015-11-08 11:11
288 查看
作为前端人员表单是经常会遇到这样的状况,设计给的效果图的表单做的很漂亮。但是基于表单的很多默认样式很多人肯定也是束手无策了。接下来我就给大家分享一下我的美化方法,其核心思想就一个你肯能一看就懂。(顺便加了几个你可能没用过的几个file属性,一起来看看吧!)
html代码:
效果展示:
样式1:
/*j_filestyle1*/ .j_upload { padding: 4px 10px; height: 20px; line-height: 20px; position: relative; cursor: pointer; color: #888; background: #fafafa; border: 1px solid #ddd; border-radius: 4px; overflow: hidden; display: inline-block; *display: inline; *zoom: 1; display:block; margin:30px auto; text-align:center; } .j_upload input { position: absolute; font-size: 100px; right: 0; top: 0; opacity: 0; filter: alpha(opacity=0); cursor: pointer; text-align:center; } .j_upload:hover { color: #444; background: #eee; border-color: #ccc; text-decoration: none }
样式2:
/*j_filestyle2*/ .j_file { box-shadow:0px 6px 3px #aaa; position: relative; display: inline-block; background:#398; border-radius: 4px; padding: 4px 12px; overflow: hidden; color: #fff; text-decoration: none; text-indent: 0; line-height: 20px; display:block; margin:30px auto; text-align:center; } .j_file input { position: absolute; font-size: 100px; right: 0; top: 0; opacity: 0; } .j_file:hover { box-shadow:0px 6px #666; background:#396; text-decoration: none; }
html代码:
<form action="" method="post"> <h3>单张图片上上传</h3> <span class="j_upload"> <input type="file" accept="image/jpeg,image/png,image/gif" name="" >上传头像 </span> <h3>单张图片指定格式上传(jpg,png,gif)</h3> <span class="j_upload"> <input type="file" accept="image/jpeg,image/png,image/gif" name="" >上传头像 </span> <h3>多张图片指定格式上传(jpg,png,gif)</h3> <span class="j_upload"> <input type="file" accept="image/jpeg,image/png,image/gif" multiple="multiple" name="" >上传头像 </span> <h3>多个word文件上传</h3> <span class="j_file">选择文件 <input type="file" name="" accept="application/msword," multiple="multiple" > </span> </form>
相关文章推荐
- C#概述
- 1000行代码读懂Spring- 实现一个基本的IoC容器
- WinRAR分割超大文件
- 通过XmlDocument读写Xml文档参考地址
- 大excel文件分割排版为印刷pdf格式:对指定行加粗
- 11.8笔记python webpy优雅的设置静态文件路径,macos防止休眠
- 为什么PS输入文字字号很小,却显示特别大
- 如何免费上传4G以上大文件至百度云网盘
- 搭建集群---网络化知识
- 键盘事件
- POJ 2377 Bad Cowtractors(最大生成树)
- thinkphp连接数据库
- mac osx使用80端口(使用nginx解决)
- 冒泡排序
- 今日学习札记——C++Primer补充2(11.8)
- hdu2222 Keywords Search (AC自动机)
- 顺序栈初始化,判空,进栈,出栈,打印
- [转]非常牛叉的楼主,自己的问题其实就是答案--用springmvc上传文件时报The current request is not a multipart request异常
- svn图标不显示的解决方案
- 虚拟机中伪分布式Hadoop的部署