【发布时间】:2010-12-17 03:19:32
【问题描述】:
我正在构建一个针对 iPhone 的 webapp。在大多数情况下,我不希望用户能够选择屏幕上的文本(即按钮文本、工具栏等),所以在我的 css 中我指定了 -webkit-user-select: none 的默认行为;.但是在某些表格单元格上,我确实希望用户能够选择文本,所以我应用了 .selectable 下面的 css 类,它将 -webkit-user-select: 更改为自动。现在这适用于 Chrome 和 Safari,但不适用于 iPhone。有人可以解释为什么和/或如何解决它吗?
body {
/* Remove the iphone callout */
-webkit-touch-callout: none;
/* Remove the iphone link highlight */
-webkit-tap-highlight-color: rgba(0,0,0,0);
/* Prevent the automatic resizing of text */
-webkit-text-size-adjust: none;
/* Limit copy and paste to only elements we want */
-webkit-user-select: none;
overflow-x: hidden;
font-family: Arial, Helvetica, sans-serif;
font-size:13px;
margin:0;
padding:0;
min-height:460px;
}
.selectable, input, textarea {
-webkit-user-select: auto;
}
编辑:我尝试完全删除 -webkit-user-select:none,虽然它允许我选择其他内容,但它不允许我选择表格单元格的文本,只能选择整个行.无论如何要让它按原样工作还是我需要完全删除表格?
【问题讨论】:
标签: iphone html css web-applications