Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 无法制作关键帧动画_Html_Css_Flexbox_Slider_Css Animations - Fatal编程技术网

Html 无法制作关键帧动画

Html 无法制作关键帧动画,html,css,flexbox,slider,css-animations,Html,Css,Flexbox,Slider,Css Animations,我尝试通过css关键帧制作带有图像的滑块,但我无法使用,以下是代码: *{ margin:0; padding:0; } li { font-size: 20px; margin: 10px; display : inline-block; } a { color: black; text-decoration: none; } a:hover { transform: scale(1.05); } li:hover { transform

我尝试通过css关键帧制作带有图像的滑块,但我无法使用,以下是代码:

*{
  margin:0;
padding:0;
}

li {
   font-size: 20px;
margin: 10px;
  display : inline-block; } 

a {
   color: black;
   text-decoration: none;   }

a:hover {
    transform: scale(1.05);
}

li:hover {
    transform: scale(1.02);    }

ul li a {
    display: block;
    font-size: 25px;
    color: white ;
         }


.slider {
    min-height: 50vh;
    overflow: hidden;
    width: 100%;
    min-height: 90vh;
    background: url(../images/8.jpg);
    animation: 50s slider infinte;   }
  

  @keyframes slider {
      0% {background: url(../images/2.jpg);}
      25% { background: url(../images/3.jpg);}
     50% {background: url(../images/4.jpg);}
     65% { background: url(../images/5.jpg);}
     85% {background: url(../images/6.jpg);}
   100% {background: url(../images/7.png);}
  }

请注意:slider它是一个在div标记中整型的类,在导航栏后面是空的。

您是否尝试过使用“background image”属性而不是仅仅使用“background”?

您的滑块的默认背景是
。/images/8.png
,但是您给了它
0%{background:url(../images/2.jpg);}
。这可能是个问题。我认为默认值应该与0%关键帧相同

    .slider {
        min-height: 50vh;
        overflow: hidden;
        width: 100%;
        min-height: 90vh;
        background: url(../images/8.jpg);
        animation: 50s slider infinte;   }
      
    
      @keyframes slider {
          0% {background: url(../images/8.jpg);}
          25% { background: url(../images/3.jpg);}
         50% {background: url(../images/4.jpg);}
         65% { background: url(../images/5.jpg);}
         85% {background: url(../images/6.jpg);}
       100% {background: url(../images/7.png);}
      }

欢迎来到堆栈溢出!寻求代码帮助的问题必须包括在问题本身中重现代码所需的最短代码,最好是以最短的代码。看见