移动浏览器

时间:2018-04-21 11:52:23

标签: html css css3 animation mobile-browser

我刚学会用CSS制作动画。在桌面Chrome上一切正常。但是当我在Chrome for Android上查看时 - 点击时会出现一些奇怪的叠加效果。

Code

.btn {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  display: block;
  position: relative;
  margin: 0 auto;
  outline: none;
  border: none;
  background-color: #ff8800;
  padding: 25px 65px;
  font-size: 25px;
  text-transform: uppercase;
  border-radius: 25px;
  box-shadow: 0 8px #ff6600;
  cursor: pointer;
  top: 0;
  transition: all .3s;
}

.btn:hover {
  top: 3px;
  box-shadow: 0 5px #ff6600;
}

.btn:active {
  top: 8px;
  box-shadow: none;
}
<button class="btn">Click Me!</button>

屏幕截图:

正常状态:

enter image description here

点击:

enter image description here

如何在移动浏览器上摆脱这种奇怪的叠加层?感谢。

1 个答案:

答案 0 :(得分:0)

如果您想在所有可点击的元素上阻止此问题,请-webkit-tap-highlight-color: transparent;添加.btn到您的body班级(如果您希望在所有可点击的元素上阻止这种情况,请加全球var http = require('http'); var port = 8080; //import a module for using the function var dt = require('./module.js'); //import an html file. var fs=require('fs'); http.createServer(function (req, res) { fs.readFile('test.html',function(err,data) { res.writeHead(200, {'Content-Type': 'text/html'}); res.write(data); res.end(); }); }).listen(port); console.log("Serveur tourne sur http://localhost:"+port); 。)

参考:https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-tap-highlight-color

演示:https://codepen.io/teodragovic/pen/yjYLaM?editors=0100#0

相关问题