【问题标题】:text field not working in safari文本字段在 Safari 中不起作用
【发布时间】:2013-12-10 13:26:13
【问题描述】:

我正在开发一个在线 eBay 利润预测计算器here

我似乎无法让输入字段在 safari 和移动 safari 中工作。它们在 FF 和 Chrome 中运行良好。我点击它们,但是当我输入时没有任何显示。我一直在搜索谷歌,但似乎找不到任何线索。我想知道我是否在css中遗漏了一些东西。这是输入字段的 css:

input {
    width: 155px;
    padding-left: 5px;
    height: 24px;
    cursor: text;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 3px;
    box-shadow: inset 1px 1px 2px black;
    -moz-box-shadow: inset 1px 1px 2px black;
    -webkit-box-shadow: inset 1px 1px 2px black;
    background-color: #F8FBEF;
 }

【问题讨论】:

    标签: css safari vendor-prefix


    【解决方案1】:

    你的问题出在calcstyle.css这里:

    * { 
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    

    我不完全确定为什么 user-select: none; 会阻止您输入输入,但删除此块会为我解决问题。


    编辑

    这是一个可能的解决方案:

    选择所有内容但您的输入...

    *:not(input.field) {    
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    

    【讨论】:

    • 太好了,这解决了我在 sencha touch 应用程序中的搜索字段问题,该字段在 safari 中不会激活。
    • 将输入设置为...-user-select: text 将是另一种选择(以确保输入适用于任何全局css设置)。
    • 天哪……花了两天时间……非常感谢!!
    • 解决方案最适合我的需要:使用它来停止拖动鼠标以选择屏幕上的项目。从“无”更改为“文本”允许使用鼠标选择项目。
    【解决方案2】:

    这似乎仍然是 Safari 9.0.3 和 iOS 9.2 的问题。最终为我解决的问题是将其设置为 text:

    input, textarea {
      -webkit-user-select: text;
      -khtml-user-select: text;
      -moz-user-select: text;
      -ms-user-select: text;
      user-select: text;
    }
    

    【讨论】:

      猜你喜欢
      • 2023-03-29
      • 2015-08-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多