html - 删除 type=color 中的内边框
问题描述
当我使用 type=color 作为输入时,它有两个边框。设置border=none 只会移除外边框。但是,里面有一个很小的。我尝试了许多其他属性,但结果仍然相同。这是我的代码:
input[type="color"] {
appearance: none;
border: none;
padding:0;
height:50px;
width:50px;
}
<input type="color" name="name1" id="name1" value="#ffffff">
这就是我的意思:https ://ibb.co/N3nVFqn 我基本上想删除那个边框。
解决方案
使用::-webkit-color-swatch
选择器。
input[type="color"] {
appearance: none;
border: none;
padding:0;
height:50px;
width:50px;
}
::-webkit-color-swatch{
border:none;
}
<input type="color" name="name1" id="name1" value="#ffffff">
对于 Mozilla Firefox,请使用::-moz-color-swatch
:
input[type="color"] {
appearance: none;
border: none;
padding:0;
height:50px;
width:50px;
}
::-moz-color-swatch{
border:none;
}
<input type="color" name="name1" id="name1" value="#ffffff">
推荐阅读
- java - 如何用 Selenium 中的印地语等区域语言断言文本
- javascript - 从对象中提取所需的键和值并将其分配给 Javascript 中的新对象
- javascript - 使用 %%javascript 魔术时如何从 JupyterHub 工作区打开文件?
- node.js - npm run build 在本地机器上工作正常,但在远程 ubuntu 服务器上显示错误
- angular - 角度 10 表单重置触发验证错误
- c# - 如何在 linq 中比较没有时间部分的日期?
- database - 浏览器删除cookie后如何从数据库中删除JWT
- python - 我应该在 try/except 之后使用 finally 吗?
- go - golang 复制和分配切片的区别
- python - 赋值表达式可以使用列表理解创建斐波那契数列吗?