Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.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 css中的闪烁背景图像_Html_Css - Fatal编程技术网

Html css中的闪烁背景图像

Html css中的闪烁背景图像,html,css,Html,Css,我想使用css闪烁我的bg图像 它应该快速闪烁,我不知道怎么做 我只能使用HTML和CSS header { width: 100%; height: 100vh; background-image : url('bg.jpg'); animation: blinkingBackground 2s infinite; background-position: right bottom, left top; background-size: cover; backgro

我想使用css闪烁我的bg图像

它应该快速闪烁,我不知道怎么做

我只能使用HTML和CSS

header {
  width: 100%;
  height: 100vh;
  background-image : url('bg.jpg');
  animation: blinkingBackground 2s infinite;
  background-position: right bottom, left top;
  background-size: cover;
  background-repeat: no-repeat;
  font-family: 'Dosis', sans-serif;
}
我还补充说

animation: blinkingBackground 2s infinite;

但它不起作用。

你需要这样的东西吗

.html\u图像{
背景图像:url('https://i.picsum.photos/id/686/536/354.jpg?hmac=nQKjRmIoZtUkWvI-wNF8RFNW89VHuPIPT2muuPPL3QY’;
高度:200px;
动画:闪烁1s无限;
}
@关键帧闪烁{
50% {
不透明度:0;
}
}


@Ahmad的解决方案很好,但它不会平稳地消失。所以我做了一个代码,使闪烁更平滑

.html\u bg{
背景图片:url(https://cdn.arstechnica.net/wp-content/uploads/2020/09/macOSBigSur.jpg);
动画:闪烁1.5s无限;
位置:固定;
排名:0;
右:0;
底部:0;
左:0;
}
@关键帧闪烁{
50% {
不透明度:0;
}
}


请发布关于blinkingBackground动画的css请发布足够的HTML以及blinkingBackground的关键帧,以便我们自己看到问题所在。