css - How to set border radius for color tag's color picker?
问题描述
I have tried many ways and searched a lot. I still don't know how to set border-radius
for the color picker.
PS: I'm talking about border-radius of the color picker
input[type="color"]:first-child
{
padding:0;
margin:0;
border:none;
box-shadow:none;
border-radius:100px;
background:none;
margin-bottom:20px;
}
input[type="color"]:nth-child(2)
{
padding:0;
margin:0;
border:none;
box-shadow:none;
border-radius:100px;
background:#f0bc12;
outline:none;
}
input[type="color" i]
{
border-radius:4px;
border:none;
height:40px;
width:100px;
display:block;
}
<input type="color" name="color" value="#37a131">
<input type="color" name="color" value="#f0bc12">
- I can remove the default background for the color tag but I can't set border-radius for the color picker (see 1st output)
- I can change the background of the color tag but I can't remove the border of the color picker (see 2nd output)
Is this possible?
I'll appreciate any help thanks.
解决方案
尝试这个:
input[type="color"]:first-child {
padding: 0;
margin: 0;
border: none;
box-shadow: none;
border-radius: 100px;
background: none;
margin-bottom: 20px;
}
input[type="color"]::-webkit-color-swatch-wrapper {
padding: 0;
}
input[type="color"]::-webkit-color-swatch {
border: none;border-radius:4px;
}
input[type="color"]:nth-child(2) {
padding: 0;
margin: 0;
border: none;
box-shadow: none;
border-radius: 100px;
background: #f0bc12;
outline: none;
}
input[type="color" i] {
border-radius: 4px;
border: none;
height: 40px;
width: 100px;
display: block;
}
演示:http: //jsfiddle.net/1os9250n/2/
推荐阅读
- tensorflow - Tensorflow保存pb文件之前如何访问文件夹名称?
- c# - OWIN 现有的实现问题 & 是否有好的认证架构?
- spring-boot - Spring Boot嵌入式tomcat中是否有用于https重定向的特定端口?
- sql-server - 大数据传输时如何避免增加ldf?
- scala - 使用高阶函数来简洁 scala 代码
- python - Kivy - 在小部件而不是窗口上拖动文件
- wpf - MaxWidth 和 MaxHeight 将较小的图像扩展到它们的实际值之外
- php - 分配一个变量并在分配后返回一个值
- mysql - Jetbrains Exposed 生成重复的外键
- php - 使用 php 中的 curl 将 json 发布到 API