当您在iPad上的Safari中触摸HTML元素时,它会变成灰色。决定嵌套元素中的哪个元素显示为灰色的逻辑是什么? [英] When you touch an HTML element in Safari on the iPad, it turns gray. What is the logic to decide which element among nested elements is shown in gray?

查看:127
本文介绍了当您在iPad上的Safari中触摸HTML元素时,它会变成灰色。决定嵌套元素中的哪个元素显示为灰色的逻辑是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您触摸iPad上的网页中的某个元素(例如编辑框)时,它会在触摸时变成灰色。

我有一个由浮动div包裹的桌子。当一个数据元素被触摸时,整个表格(或其包装div)将变为灰色,而不是单个数据元素或行变灰。 (这个表的功能是一个自动完成的弹出窗口)



在网站的其他地方,我有一个表格,其中只有被触摸的数据元素变灰。



我想知道是否有人能够指导我解释这种灰色背景下的逻辑,以便我们可以编写我们的表来给出所需的行为。理想情况下,我们希望该行在被触摸时突出显示。



或者,如果我们可以关闭这种灰色行为,那将是另一种选择。然后,我们可以自己编写突出显示。有没有办法关闭这个特定的html元素的行为?



谢谢。

解决方案

这位作者提出了一个解决方案,以消除突出显示:


如果因为某种原因你不想让你的网站的某些元素网站或应用程序要突出显示,只需将以下CSS规则添加到相应的元素。




  -webkit-tap-highlight-color:rgba(0,0,0,0); 

它不会禁用突出显示,但会使其不可见(不透明度为零)。



然而,我还没有测试过。


When you touch an element, such as an edit box, in a web page on the iPad, it turns gray while you are touching it.

I have a table wrapped by a floating div. Instead of an individual data element or row going gray, the whole table (or its wrapping div) goes gray when a data element is touched. (The function of this table is an autocomplete pop-up)

Elsewhere in the site, I have a table in which only the touched data element goes gray.

I wondered if anyone could direct me to an explanation of the logic behind this graying on touch, so that we can code our table to give the desired behavior. Ideally, we'd like the row to highlight when it is touched.

In the alternative, if we could turn off this graying behaviour, that would be another option. We could then code the highlighting ourselves. Is there a way to turn off this behavior for particular html elements?

Thanks.

解决方案

This author suggests a solution to remove the highlighting:

If for whatever reason you don't want some elements of your web site or application to be highlighted, simply add the following CSS rule to the corresponding elements.

-webkit-tap-highlight-color: rgba(0,0,0,0); 

It won't disable the highlighting, but it will make it invisible (an opacity of zero).

I have not tested this, however.

这篇关于当您在iPad上的Safari中触摸HTML元素时,它会变成灰色。决定嵌套元素中的哪个元素显示为灰色的逻辑是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆