-webkit-tap-highlight-color not applied to area tag

懵懂的女人 提交于 2020-01-03 17:20:48

问题


Ok, I know this has been asked many times, but my situation is a bit different:

I have an image map and I don't want Android/iPhone to display the green border (gray overlay on iPhone) when an AREA on the image is tapped.

I have tried -webkit-tap-highlight-color: rgba(0,0,0,0) and it seems to work for an <a> link but not an <area>. I guess the problem is that in fact no CSS can be applied to <area>?

Can this somehow be circumvented? I don't want the user to see the green border when he taps on an area.


回答1:


Unfortunately, browsers doesn't allow to set(and run) css properties to area tags.

I use maphilight plugin to do that in jquery, it works like a charm : http://davidlynch.org/projects/maphilight/docs/

Example, here : http://davidlynch.org/projects/maphilight/docs/demo_usa.html

Then, I guess that you could set transparent border with : stroke: false



来源:https://stackoverflow.com/questions/8880627/webkit-tap-highlight-color-not-applied-to-area-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!