zoukankan      html  css  js  c++  java
  • 上传文件样式美化

    1、点击输入框和上传按钮都打开任务管理器(兼容IE和火狐):

    HTML:

    <div class="row">
        <input type="text" class="fileinput" readonly="readonly" />
        <a href="javascript:void(0)" class="upload">上传</a>
        <input type="file" class="file" />
    </div>

    CSS:

    .row{
        position: relative;
    }
    .fileinput{
        background: #FFFFFF;
        border: 1px solid #D7D7D7;
        height: 24px;
        padding: 6px 9px;
        width: 450px;
        color: #666666;
        outline: none;
        float: left;
    }
    .upload{
        width: 90px;
        height: 38px;
        line-height: 38px;
        text-align: center;
        background: #666A82;
        border-radius: 5px;
        color: #FFFFFF;
        font-size: 16px;
        float: right;
    }
    .upload:hover{
        background: #76798F;
        text-decoration: none;
    }
    .file{
        position: absolute;
        left: 0;
        width: 570px;
        top: 0;
        height: 38px;
        font-size/***/:570px9;/*IE*/
        filter: alpha(opacity=0);
        opacity: 0;
        cursor: pointer;
        overflow: hidden;
    }

     JS:

    $(".file").change(function(){
        $(".fileinput").val($(this).val());
    });

    2、上传按钮打开任务管理器(兼容IE和火狐):

    HTML:

    <a href="javascript:void(0)" class="upload">上传<input type="file" /></a>

    CSS:

    .upload{
        width: 90px;
        height: 38px;
        line-height: 38px;
        text-align: center;
        background: #666A82;
        border-radius: 5px;
        color: #FFFFFF;
        font-size: 16px;
        display:inline-block;
        position:relative;
    }
    .upload:hover{
        background: #76798F;
        text-decoration: none;
    }
    .upload input{
        position: absolute;
        left: 0;
        right:0;
        width: 100%;
        top: 0;
        bottom: 0;
        height: 100%;
        filter: alpha(opacity=0);
        opacity: 0;
        cursor: pointer;
        overflow: hidden;
    }
  • 相关阅读:
    30分钟学会如何使用Shiro
    Java NIO 系列教程
    Kafka学习之路
    Kafka消费组(consumer group)
    潭拓寺
    如何设置 ssh secure shell 支持中文
    goaccess nginx 日志分析
    【转】服务化框架技术选型与京东JSF解密
    java ee wildfly 批处理 job 工作
    wildfly 10上使用最新的 Hibernate ORM OGM
  • 原文地址:https://www.cnblogs.com/sakura-panda/p/5666444.html
Copyright © 2011-2022 走看看