增加 IE 11 中的复选框大小
Increase checkbox size in IE 11
我在使用 Internet Explorer 11 时遇到了一个可悲的问题,因为它无法正确缩放复选框,这与 Firefox 不同正确的。这是我的 css 代码:
input[type="checkbox"] {
-ms-filter: progid:DXImageTransform.Microsoft.Matrix(M11=1.5, M12=0, M21=0, M22=1.5, SizingMethod='auto expand');
-moz-transform: scale(1.5); /* FF */
transform: scale(1.5);
padding: 5px;
}
我用这个替换了 -ms-filter
,但没有用:
filter: progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand',
M11=1.5320888862379554, M12=-1.2855752193730787,
M21=1.2855752193730796, M22=1.5320888862379558);
然后用这个,但还是不行:
-ms-transform: scale(1.5);
不幸的是,none 我的尝试是成功的,SO 中没有任何地方说明如何修复它。通常 scale()
应该在 IE 9 上工作,但似乎他们在 IE 11 中禁用了它。正如我所说,它在 Firefox 中工作正常但在 IE 11 中不工作。
Here 我阅读了:
[5] Internet Explorer 11.0 supports the -webkit prefixed variant as an alias for the default one.
如果这没有帮助,这可能是复选框特有的问题。但是,使用 HTML 和 CSS:
可以更好地设置复选框样式
input[type=checkbox] {
display: none;
}
input[type=checkbox] + .cb {
display: inline-block;
width: 22px;
height: 22px;
margin: -4px 0;
border: 1px solid gray;
border-radius: 3px;
transition: .2s;
box-sizing: border-box;
box-shadow: inset 0 0 0 1px white;
}
input[type=checkbox] + .cb:before {
content: "✓";
color: white;
position: absolute;
line-height: 20px;
font-size: 16px;
margin: 0 0 0 5px;
}
input[type=checkbox] + .cb:hover {
box-shadow: inset 0 0 0 1px #0055ff;
border-color: #0055ff;
}
input[type=checkbox]:checked + .cb {
box-shadow: inset 0 0 0 10px #0055ff;
border-color: #0055ff;
}
input[type=checkbox]:checked + .cb:hover {
box-shadow: inset 0 0 0 10px #3377ff;
}
<label>
<input type="checkbox" checked>
<div class="cb"></div>
Style checkbox with CSS
</label>
我在使用 Internet Explorer 11 时遇到了一个可悲的问题,因为它无法正确缩放复选框,这与 Firefox 不同正确的。这是我的 css 代码:
input[type="checkbox"] {
-ms-filter: progid:DXImageTransform.Microsoft.Matrix(M11=1.5, M12=0, M21=0, M22=1.5, SizingMethod='auto expand');
-moz-transform: scale(1.5); /* FF */
transform: scale(1.5);
padding: 5px;
}
我用这个替换了 -ms-filter
,但没有用:
filter: progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand',
M11=1.5320888862379554, M12=-1.2855752193730787,
M21=1.2855752193730796, M22=1.5320888862379558);
然后用这个,但还是不行:
-ms-transform: scale(1.5);
不幸的是,none 我的尝试是成功的,SO 中没有任何地方说明如何修复它。通常 scale()
应该在 IE 9 上工作,但似乎他们在 IE 11 中禁用了它。正如我所说,它在 Firefox 中工作正常但在 IE 11 中不工作。
Here 我阅读了:
[5] Internet Explorer 11.0 supports the -webkit prefixed variant as an alias for the default one.
如果这没有帮助,这可能是复选框特有的问题。但是,使用 HTML 和 CSS:
可以更好地设置复选框样式input[type=checkbox] {
display: none;
}
input[type=checkbox] + .cb {
display: inline-block;
width: 22px;
height: 22px;
margin: -4px 0;
border: 1px solid gray;
border-radius: 3px;
transition: .2s;
box-sizing: border-box;
box-shadow: inset 0 0 0 1px white;
}
input[type=checkbox] + .cb:before {
content: "✓";
color: white;
position: absolute;
line-height: 20px;
font-size: 16px;
margin: 0 0 0 5px;
}
input[type=checkbox] + .cb:hover {
box-shadow: inset 0 0 0 1px #0055ff;
border-color: #0055ff;
}
input[type=checkbox]:checked + .cb {
box-shadow: inset 0 0 0 10px #0055ff;
border-color: #0055ff;
}
input[type=checkbox]:checked + .cb:hover {
box-shadow: inset 0 0 0 10px #3377ff;
}
<label>
<input type="checkbox" checked>
<div class="cb"></div>
Style checkbox with CSS
</label>