输入不适用于IE

时间:2012-10-03 12:07:44

标签: jquery css internet-explorer cross-browser

我用jquery编写了一个js计算器,它适用于IE以外的主流浏览器,主要问题是输入元素根本不显示,输入无法显示在它们上面。 输入被禁用以防止非法输入,我认为这可能是原因,但使他们doe不能解决它。 代码位于https://github.com/ZackYovel/jQCalc/tree/master/pathTo,演示位于http://jqcalc.co.nf/ 这里也是输入的css: 输入用这个div包装:

#jQCalc-input-container:focus {
    border: thin solid #fff;
    background: rgb(237,247,253); /* Old browsers */
    background: -moz-linear-gradient(top, rgba(237,247,253,1) 0%, rgba(255,255,255,1) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(237,247,253,1)), color-stop(100%,rgba(255,255,255,1))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, rgba(237,247,253,1) 0%,rgba(255,255,255,1) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, rgba(237,247,253,1) 0%,rgba(255,255,255,1) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top, rgba(237,247,253,1) 0%,rgba(255,255,255,1) 100%); /* IE10+ */
    background: linear-gradient(to bottom, rgba(237,247,253,1) 0%,rgba(255,255,255,1) 100%); /* W3C */
    -ms-filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#edf7fd', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
}

这些是输入:

#jQCalc-expression-line, #jQCalc-result-line {
    display: table-row;
    background: none;
    width: 95%;
    margin: 0 auto;
    border: none;
    outline: none;
    font-weight: bold;
}

#jQCalc-result-line {
    letter-spacing: 1px;
    font-size: 14pt;
}

#jQCalc-expression-line {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    letter-spacing: 2px;
}

1 个答案:

答案 0 :(得分:0)

它只适用于IE8或更高版本,请点击此处查看网站兼容性:

http://www.quirksmode.org/css/css2/display.html

另外,请注意你的display:table-row元素,需要嵌套在display:table元素中。其他一些浏览器可能会为您自动更正此问题。

因为这个原因,我会避免使用display:table。您通常应该能够在没有它的情况下实现所需的布局,使用具有更高兼容性的css网格系统。