在制作某个移动端项目的时候,发现当我们点击链接,input标签或者div盒子的时候,整个标签会出现颜色块并会闪烁一下,不仅影响美观,而且会极大降低了用户体验。
  解决方案:-webkit-tap-highlight-color: transparent;//透明
调试:-webkit-tap-highlight-color:red; //加上这行代码,背景就会变成红色。
代码:
<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <meta name="viewport"
 content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
 <title>Title</title>
 <style>
 a{
 width: 100px;
 height: 100px;
 display: block;
 border: 1px solid #ccc;
 -webkit-tap-highlight-color: transparent;
 }
 div{
 width: 100px;
 height: 100px;
 border: 1px solid red;
 cursor: pointer;
 }
 </style>
</head>
<body>
<a href="#"></a>
<input type="text">
<div></div>
</body>
</html>
