0

可能重复:
在 HTML 中制作一个 <button> 链接
如何将 CSS 应用于浏览按钮

如何将浏览按钮设置为看起来像一个链接?

我的意思是

<input type=file />
4

3 回答 3

1

试试这个方法:

  1. 在输入文件的顶部覆盖一个 div。
  2. 将输入文件的不透明度更改为 0。

    div.text {
        position: absolute;
        top: 0;
        left: 0;
        text-decoration: underline;
        color: blue;
    }
    div.wrapper {
        position: relative;
    }
    input { opacity: 0; }
    ​
    
    <div class="wrapper">
         <div class="text">I'm not a link you fool</div>
        <input type="file"/>
    </div>
    ​
    

演示:http: //jsfiddle.net/codef0rmer/BZeMG/

于 2012-08-22T06:52:50.143 回答
1

本教程应该对你有所帮助,

http://www.quirksmode.org/dom/inputfile.html

于 2012-08-22T07:03:43.543 回答
0

如果您谈论的是 a 的浏览按钮,<input type=file />则不能这样做。你必须去一个 jquery/ajax 文件上传插件,用自定义的东西替换原来的按钮。看看这里的列表:

http://creativefan.com/10-ajax-jquery-file-uploaders/

看看你是否找到你喜欢的东西。

于 2012-08-22T06:22:37.760 回答