【发布时间】:2018-02-28 23:13:26
【问题描述】:
CSS
.checkbox label:after {
content: '';
clear: both;
display: table;
}
.checkbox .cr {
display: table-cell;
position: relative;
border: 1px solid #a9a9a9;
border-radius: .25em;
width: 4vw;
height: 4vw;
}
.checkbox .cr .cr-icon {
position: absolute;
font-size: 1.5vw;
line-height: 0;
top: 2vw;
left: 1.2vw;
}
.checkbox label input[type="checkbox"] {
display: none;
}
.checkbox label input[type="checkbox"] + .cr > .cr-icon {
transform: scale(3) rotateZ(-20deg);
opacity: 0;
transition: all .3s ease-in;
}
.checkbox label input[type="checkbox"]:checked + .cr > .cr-icon {
transform: scale(2) rotateZ(0deg);
opacity: 1;
}
HTML
<div class="checkbox">
<label>
<input type="checkbox" value="" checked>
<span class="cr"><i class="cr-icon fa fa-check"></i></span>
</label>
</div>
外部 CSS
https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css
我有一个自定义 CSS 复选框。假设当我缩小屏幕宽度时,复选框和勾号的大小将按比例缩小。
无论屏幕尺寸多么小,它在 IE 中都可以正常工作,并且刻度可能非常小,这是预期的。问题是在 Chrome 中,当屏幕宽度非常小时,勾号会溢出。
我已经设置了 JSFiddle https://jsfiddle.net/7fuL1zh3/5/ 希望有人能帮我一把谢谢。
【问题讨论】:
标签: html css google-chrome font-size