【发布时间】:2018-07-27 16:43:31
【问题描述】:
$("#colour").change(function(event) {
console.log($(this).val());
});
input[type=color] {
width: 100px;
height: 100px;
border-radius: 50%;
overflow: hidden;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type='color' value='#fefefe' class='bar' id='colour'>
即使我将<input type='color'> 进行了四舍五入,但当我输入一个值(至少在 safari 中)时,它会将圆形改为正方形。我怎样才能做到这一点?谢谢。
【问题讨论】:
-
溢出:隐藏?和边框:无,大纲:无..
-
@TemaniAfif 不,它们或它们的组合都不起作用。
-
Webkit 有一些可能有用的非官方 CSS 选择器。在这里查看答案:Webkit CSS to control the box around the color in an input[type=color]。它works for me in Chrome,但当然不是很好的跨浏览器兼容。
-
相关参考:Styling native elements.
标签: javascript html css input colors