给网站添加一个启动开屏动画的教程

直接教程开始:

图片需要清晰可见,然后去自定义css里填入下方的代码:

/*开屏动画*/
body:after {
    content: " ";
    position: fixed;
    inset: 0;
    background-color: white;
    z-index: 999;
    background-image: url(图片链接);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
    animation: fadeOut 3s;
    animation-fill-mode: forwards;
    -webkit-transition: fadeOut 3s;
    transition: fadeOut 3s;
    pointer-events: none;
}
@keyframes fadeOut {
  50% {
    opacity: 1;
  }
 
  100% {
    opacity: 0;
  }
}

background-size是调大小的,我设置成100%,是铺满整个屏幕的意思。

👋 感谢您的观看!

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享