input按钮上传按钮样式

╰半夏微凉° 2021-12-17 09:37 587阅读 0赞

主要是定位和不透明度来实现:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Document</title>
  6. <style>
  7. /*a upload */
  8. .a-upload {
  9. padding: 4px 10px;
  10. height: 20px;
  11. line-height: 20px;
  12. position: relative;
  13. cursor: pointer;
  14. color: #888;
  15. background: #fafafa;
  16. border: 1px solid #ddd;
  17. border-radius: 4px;
  18. overflow: hidden;
  19. display: inline-block;
  20. *display: inline;
  21. *zoom: 1
  22. }
  23. .a-upload input {
  24. position: absolute;
  25. font-size: 100px;
  26. right: 0;
  27. top: 0;
  28. opacity: 0;
  29. filter: alpha(opacity=0);
  30. cursor: pointer
  31. }
  32. .a-upload:hover {
  33. color: #444;
  34. background: #eee;
  35. border-color: #ccc;
  36. text-decoration: none
  37. }
  38. .file {
  39. position: relative;
  40. display: inline-block;
  41. background: #D0EEFF;
  42. border: 1px solid #99D3F5;
  43. border-radius: 4px;
  44. padding: 4px 12px;
  45. overflow: hidden;
  46. color: #1E88C7;
  47. text-decoration: none;
  48. text-indent: 0;
  49. line-height: 20px;
  50. }
  51. .file input {
  52. position: absolute;
  53. font-size: 100px;
  54. right: 0;
  55. top: 0;
  56. opacity: 0;
  57. }
  58. .file:hover {
  59. background: #AADFFD;
  60. border-color: #78C3F3;
  61. color: #004974;
  62. text-decoration: none;
  63. }
  64. </style>
  65. </head>
  66. <body>
  67. <a href="javascript:;" class="a-upload">
  68. <input type="file" name="">点击这里上传文件
  69. </a>
  70. <a href="javascript:;" class="file">选择文件
  71. <input type="file" name="">
  72. </a>
  73. </body>
  74. </html>

转载于:https://www.cnblogs.com/wang715100018066/p/6061369.html

发表评论

表情:
评论列表 (有 0 条评论,587人围观)

还没有评论,来说两句吧...

相关阅读