当前位置:首页 > 电脑知识 > 正文内容

深度揭秘(用css美化html页面)html字体美化,CSS美化html文件上传按钮的方法,CSS美化html文件上传按钮的方法,

sauo3年前 (2022-09-17)电脑知识173

写了一个带有表单的html页面,发现原生的 input 文件上传输入框样式太丑了,就琢磨着自己写个美化的样式,下面就是 html input 文件上传样的美化方法,单纯的只用CSS实现,很简单的。

CSS 美化input上传按钮样式的方法

美化实现逻辑:

1、用 div 元素写一个美化的上传按钮

2、将 input 上传按钮的透明度设置为 0 ,并将其绝对定位到 div 元素上方即可

先上示例演示图片:

示例代码:

Markup
<style> .filediv{ position: relative; } .filediv input{ opacity: 0; width: 100px; height: 35px; position: absolute; left: 0; top: 0; z-index: 99; } .filediv div{ height: 35px; line-height: 35px; background-color: #03a9f4; color: #fff; width: 100px; text-align: center; font-size: 14px; position: absolute; top: 0; left: 0; z-index: 98; } </style> <!-- 飞鸟慕鱼博客 http://feiniaomy.com --> <form name="form1" id="form1"> <div class="filediv"> <input type="file" id="btn_file" name="file"></input> <div>上传文件</div> </div> </form>复制

本文链接:http://blog.sauo.top/?id=308 感谢分享!

分享到:

扫描二维码推送至手机访问。

版权声明:本文由冬眠先生个人博客发布,如需转载请注明出处。

本文链接:http://blog.sauo.top/?id=308

分享给朋友:

“深度揭秘(用css美化html页面)html字体美化,CSS美化html文件上传按钮的方法,CSS美化html文件上传按钮的方法,” 的相关文章

原创(禁止ping命令操作)linux如何停止ping,linux禁ping操作的方法,linux禁ping操作的方法,

免费领取腾讯云服务器! linux中可以通过ssh命令来禁止其它机器来ping自己,下面是配置方法,大家可以参考一下。 linux中禁ping的方法 方法1 临时禁ping,系统重启后失效,已在ubuntu系...

硬核推荐(ubuntu取消自动休眠)ubuntu关闭自动休眠命令,ubuntu 关闭自动休眠模式的方法,ubuntu 关闭自动休眠模式的方法,

硬核推荐(ubuntu取消自动休眠)ubuntu关闭自动休眠命令,ubuntu 关闭自动休眠模式的方法,ubuntu 关闭自动休眠模式的方法,

免费领取腾讯云服务器! 在使用ssh连接ubuntu系统时,发现长时间不输入ssh命令ssh就会自动断开。查找了一下原因,发现是安装ubuntu的电脑自动进入了休眠模式,而ubuntu系统中有多种关闭自动休眠的方法,下面就来说一说使用ssh命令来关闭ubu...

万万没想到(Ubuntu安装ssh服务)ubuntu配置ssh服务器,ubuntu安装ssh服务器的方法,ubuntu安装ssh服务器的方法,

万万没想到(Ubuntu安装ssh服务)ubuntu配置ssh服务器,ubuntu安装ssh服务器的方法,ubuntu安装ssh服务器的方法,

免费领取腾讯云服务器! 安装了一个ubuntu系统,想着在内网中用ssh进行远程连接管理。下面这篇博文就说说如果在ubuntu系统中安装ssh远程管理服务。 ubuntu 安装ssh服务器的方法 1、安装 openssh-s...

干货分享(php file_get_contents curl)php file_get_contents post,php file_get_contents(): SSL operation failed with code 1. OpenSSL Error message.....,php file_get_contents(): SSL operation failed with code 1. OpenSSL Error message.....,

免费领取腾讯云服务器! 在调试php脚本代码时,发现使用 file_get_contents() 函数请求HTTPS的网址链接时出现了报错,其报错代码如下面所示“file_get_contents(): SSL operation failed with...

这都可以(PHP百度百科)pHp是什么,php中关于strtotime函数31日取前几个月日期的BUG,php中关于strtotime函数31日取前几个月日期的BUG,

免费领取腾讯云服务器! 在使用php脚本中的 strtotime 函数取前几个月的日期时,发现每到31日时,取出的前几个月的日期都会出现错误。仔细检查了一下,发现在利用 strtotime 函数取前几个月的日期时,给 strtotime 函数的参数并不规范...

这都可以?(jquery去掉前后空格)jquery去掉字符串前后空格,jQuery去掉 serialize() 方法中指定的name值,jQuery去掉 serialize() 方法中指定的name值,

免费领取腾讯云服务器! 在修改一个前台表单提交逻辑时,为了不动以前的代码(代码和屎一样),就想着在提交数据时过滤掉form表单中指定的name属性和值,由于表单直接使用jquery中的serialize()方法来获取的form表单的数据,所以就要对 ser...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。