【问题标题】:Increase checkbox size in IE 11增加 IE 11 中的复选框大小
【发布时间】:2017-06-23 21:26:53
【问题描述】:

我在使用 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); 

不幸的是,我的任何尝试都没有成功,而且在 SO 中也没有说明如何解决它。通常scale() 应该可以在 IE 9 上运行,但似乎他们在 IE 11 中禁用了它。正如我所说,它在 Firefox 中运行良好,但在 IE 11 中无法运行。

【问题讨论】:

    标签: css internet-explorer checkbox internet-explorer-11


    【解决方案1】:

    Here我看了:

    [5] Internet Explorer 11.0 支持 -webkit prefixed variant as an alias for the default one

    如果这没有帮助,这可能是复选框特有的问题。但是,有一种更好的方法可以使用 HTMLCSS 来设置复选框的样式:

    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>

    【讨论】:

    • 这很难看,但它有效,并且在 IE11 中适用于我的愚昧客户。
    猜你喜欢
    • 1970-01-01
    • 2012-01-04
    • 2011-01-03
    • 1970-01-01
    • 1970-01-01
    • 2011-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多