css - 更改默认颜色选择器框
问题描述
我将 Angular6 与材料设计一起使用。我想要做的是从mat-form-field
. 为此,我matinput type="color"
在我的input
标签中使用。我的HTML文件如下,
<div>
<mat-form-field class="form-field">
<mat-label>Color</mat-label>
<input matInput type="color" formControlName="color"required placeholder="Color">
</mat-form-field>
</div>
然后我在上面添加了一些 CSS 来根据我的需要设计颜色选择器框,
input[type="color"] {
-webkit-appearance: none;
border: none;
width: 25px;
height: 25px;
float: right;
}
input[type="color"]::-webkit-color-swatch-wrapper {
padding: 0;
}
input[type="color"]::-webkit-color-swatch {
border: none;
}
即使这默认包含黑色,表单字段也没有得到任何默认输入。所以我想做的是得到如下的默认颜色框。(为了轻松理解我使用 Photoshop 设计的期望的要求),
解决方案
您必须添加一些样式并且需要对 ts 文件代码进行一些更改才能显示该框
推荐阅读
- php - PDO 不关联使用 bindParam() 设置的参数,并且在使用 $args 的方法中返回一个空数组
- foreach - 角度修改数组中的 forEach
- css - 如何将特定格式应用于 Rails 中的标签
- d3.js - 将日期时间字符串转换为 D3 日期时间
- c# - Unity文本未更新
- wix - 在卸载期间将参数传递给自定义操作
- ruby - 谷歌日历 API 红宝石,日期时间时区
- reporting-services - IsNothing 在 SSRS 表达式中没有按预期工作
- spring - spring 配置文件中的系统属性值
- amazon-web-services - 如何手动设置 AWS ElasticSearch 并通过浏览器使用 kibana?