【问题标题】:inputs don't work on IE输入在 IE 上不起作用
【发布时间】:2013-04-17 02:44:02
【问题描述】:

我用jquery写了一个js计算器,它可以在除IE之外的主要浏览器上运行,主要问题是输入元素根本不显示,输入也无法显示。 输入被禁用以防止非法输入,我认为这可能是原因,但启用它们并不能解决问题。 代码在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;
}

【问题讨论】:

  • 请在此处发布一些代码,足以重现问题。
  • 您是否将display: table-row 应用于输入?如果是这样,我敢打赌这会导致 IE 出现问题,也可能会导致其他浏览器出现问题。
  • 你需要支持哪些版本的IE,你测试过哪些版本?
  • pebbl,你不想回答吗?这将是一个很好的。你能告诉我为什么 table-row 会导致这个吗?

标签: jquery css internet-explorer cross-browser


【解决方案1】:

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

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

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

因此,我认为我会避免使用 display: table。您通常应该能够在没有它的情况下实现您想要的布局,并使用具有更多兼容性的类似 css 网格的系统。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-09
    • 1970-01-01
    • 2012-06-19
    • 1970-01-01
    相关资源
    最近更新 更多