html - 复选框中的刻度线大小
问题描述
在我的 Angular 应用程序中。我正在使用输入类型复选框。我正在尝试更改复选框的大小。我可以增加复选框的大小。但是,当复选框被选中时,刻度线的大小显得非常小,不适合复选框的大小。如何增加刻度线的大小以使其适合复选框。
HTML
<input type="checkbox" class="customInput">
css
.customInput {
width: 2em;
height: 2em;
}
解决方案
使用自定义元素来设置表单输入的样式:
.form-input input {
display: none;
}
.form-input .checkbox {
border: 1px solid black;
border-radius: 3px;
width: 20px;
height: 20px;
text-align: center;
}
.form-input input:checked + .checkbox:before {
content: '\2713';
display: inline;
}
<label class="form-input">
<input type="checkbox"/>
<div class="checkbox"></div>
</label>
推荐阅读
- css - 使用选择器在 2 个全局 SCSS 之间切换
- javascript - 如何在 Select2 下拉列表中捕获滚动事件?
- etcd - 放置一些值时etcd“不是目录”的结果
- docker - 有没有办法在 Google 的 AI 平台中使用外部编译包进行数据处理?
- java - 使用java 8查找列表中不存在于另一个列表中的元素
- javascript - Javascript:字符串化不适用于对象数组
- sql-server - MSSQL:如何从不同的表中删除重复的列值?
- java - 为什么在 java 中递归实现合并排序时会发生这个 Stackoverflow 异常?
- c++ - 关于使用类型转换优化除法代码的问题
- ansible - 设置 Sensu-Go 集群 - 集群未同步