Custom file Upload Button

后端 未结 3 1175
萌比男神i
萌比男神i 2021-01-27 10:18

can give an option to select the file from local machine & upload further. But i wanted a customized button which enables to open

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-27 10:30

    If you don't need the bar which shows file name, this works fine:) http://jsfiddle.net/fxfPL/

    .replaced-upload-button {
        display: inline-block;
        position:relative;
        overflow:hidden;
        /*for looks only*/background: #ffffd;padding: 5px; border: 1px solid #3d3d3d;
    }
    
    /*for looks only*/.replaced-upload-button:hover { background: orangered; color: #fff; }
    
    .original-upload-button {
        position: absolute;
        top:0;
        left:0;
        width: 9999%;
        margin-left: -9899%;
        height: 100%;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";/* IE 8 */
        filter: alpha(opacity=50);/* IE 5-7 */
        -moz-opacity: 0.5;/* Netscape */
        -khtml-opacity: 0.5;/* Safari 1.x */
        opacity: 0.5;/* Good browsers */
    }
    
    .original-upload-button:hover { cursor: pointer }
    

提交回复
热议问题