4

在我的应用程序中使用 webview 时,每次单击链接时,蓝色框都会突出显示文本或图像。是否有从 webview 中删除此功能的方法?

4

2 回答 2

2

出于可访问性的原因,您不应该只是将水龙头突出显示颜色设置为透明。

对于您想要完全控制的元素:

1.) 移除 tap-highlight-color

.btn {
    ....

    -webkit-tap-highlight-color: transparent;
}

2.) 添加一个新的:active状态(在这个例子中设置背景颜色

.btn:active {
    background-color: rgba(100, 100, 100, 1.0);
}

3.)在某些元素上,例如您可能会看到蓝色或橙色边框,这只是为了焦点状态,删除边框:

.btn {
    ....
    -webkit-tap-highlight-color: transparent;
    outline: 0;
}

4.) 添加:focus状态

.btn:focus {
    background-color: rgba(200, 200, 200, 1.0);
}

5.) 对于奖励积分,添加一个:focus:active状态

.btn:focus:active {
    background-color: rgba(150, 150, 150, 1.0);
}
于 2013-11-29T13:49:47.170 回答
1

没有 50 声望发表评论。
打击是上述答案中链接的主要内容。

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

rgba() 就像 rgb() 一样,但它需要第四个参数来表示不透明度。

于 2013-11-28T12:12:06.250 回答