为什么CSS无法在移动设备上运行?

时间:2017-10-13 11:36:44

标签: html css html5

我想将下面的图像旋转到360度及以下css应用于该图像:

<img src="" alt="" />

CSS:

.image {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    margin:-60px 0 0 -60px;
    -webkit-animation:spin 4s linear infinite;
    -moz-animation:spin 4s linear infinite;
    animation:spin 4s linear infinite;
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }

它在桌面上运行良好,但在移动设备上却没有?如果我做错了什么?

2 个答案:

答案 0 :(得分:1)

这适用于移动设备和桌面设备。

.loader {
  position: absolute;
  width: 120px;
  height: 120px;
  left: 0; right: 0;
  top: 0; bottom: 0;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  -webkit-animation: spin 4s linear infinite;
  animation: spin 4s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

答案 1 :(得分:0)

您的旋转代码可能无效,因为您尚未正确编码。 @keyframes动画中存在一些问题。

SEE THE EXAMPLE

相关问题