<input type="file">如何实现自定义样式

利用样式覆盖来实现效果:先看下原本和改变后的样式

 1 <!doctype html>
 2 <html>
 3     <head>
 4         <title>file自定义上传样式</title>
 5         <style>
 6                 *
 7                 {
 8                     margin: 0;
 9                     padding: 0;
10                 }
11                 /*蓝色按钮,绝对定位*/
12                 .btn
13                 {
14                     position: absolute;
15                     width: 100px;
16                     height: 40px;
17                     background-color: #2db7f5;
18                     color: #fff;
19                     text-align: center;
20                     font-weight: 900;
21                     border-radius: 4px;
22                 }
23                 /*自定义上传,位置大小都和btn完全一样,而且完全透明*/
24                 .file-upload
25                 {
26                     position: absolute;
27                     display: block;
28                     width: 100px;
29                     height: 40px;
30                     opacity: 0;
31                     cursor: pointer;
32                 }
33                 .file-name
34                 {
35                     position: absolute;
36                     top:40px;
37                     width: 100%;
38                     height: 30px;
39                 }
40             </style>
41     </head>
42     <body>
43         <button class="btn">上传文件</button>
44         <input type="file" class="file-upload" />
45         <div class="file-name"></div>
46     </body>
47 </html>
48 <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
49 <script>
50     $(document).ready(function()
51     {
52         $(".file-upload").change(function()
53         {
54             var arrs=$(this).val().split('\\');
55             var filename=arrs[arrs.length-1];
56             $(".file-name").html(filename);
57         });
58     });
59 </script>

 

转载于:https://www.cnblogs.com/yuzhongyu/p/10523044.html

table { border-collapse: collapse; width: 100%; } td, th { border: 1.5px solid black; padding: 5px; } table img { max-width: 150px; height: auto; } <table id="myTable"> <thead class="sticky-header"> <tr> <td contenteditable="true"><input type="text" oninput="filterTable(0)" placeholder="工艺膜层"></td> <td contenteditable="true"><input type="text" oninput="filterTable(1)" placeholder="AOI Step"></td> <td contenteditable="true"><input type="text" oninput="filterTable(2)" placeholder="不良类型"></td> <td contenteditable="true"><input type="text" oninput="filterTable(3)" placeholder="Layer(Code)"></td> <td contenteditable="true"><input type="text" oninput="filterTable(4)" placeholder="Type"></td> <td contenteditable="true"><input type="text" oninput="filterTable(5)" placeholder="Dpet"></td> <td contenteditable="true"><input type="text" oninput="filterTable(6)" placeholder="Subcode"></td> <td contenteditable="true">Code描述</td> <td contenteditable="true">Image1</td> <td contenteditable="true">Image2</td> <td contenteditable="true">Image3</td> <td contenteditable="true">Image4</td> <td contenteditable="true">Image5</td> <td contenteditable="true">Image6</td> <td contenteditable="true">判定细则</td> </tr> </thead> <tbody> <tr> <td contenteditable="true">ACT</td> <td contenteditable="true">Particle</td> <td contenteditable="true">ACT</td> <td contenteditable="true">Particle</td> <td contenteditable="true">ACT</td> <td contenteditable="true">Particle</td> <td contenteditable="true">ACT</td> <td contenteditable="true">Particle</td> <td> <input type="file" onchange="previewImage(this)" onclick="showPopup(this.src)"style="width: 100px; height: auto;" > </td> <td> <input type="file" onchange="previewImage(this)"onclick="showPopup(this.src)" style="width: 100px; height: auto;"> </td> <td> <input type="file" onchange="previewImage(this)" onclick="showPopup(this.src)"style="width: 100px; height: auto;"> </td> <td> <input type="file" onchange="previewImage(this)" onclick="showPopup(this.src)"style="width: 100px; height: auto;"> </td> <td> <input type="file" onchange="previewImage(this)" onclick="showPopup(this.src)"style="width: 100px; height: auto;"> </td> <td> <input type="file" onchange="previewImage(this)"onclick="showPopup(this.src)"style="width: 100px; height: auto;"> </td> <td contenteditable="true">Particle</td> </tr> </tbody> </table>这个表格怎么设置自定义调整列宽
最新发布
07-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值