简体   繁体   中英

how to add a preloader GIF/MP4 in HTML,CSS3

earlier i had used a spinner for loading my website. i want to change that into a video so i thought of editing the previous code, so what should i do to remove the spinner and add video the video in css link is https://techcraze.co.in/wp-content/uploads/2021/03/topp.mp4 please help me to place the video with help of this link my html

<div class="loader_bg">
    <div class="loader" img src= "https://techcraze.co.in/wp-content/uploads/2021/03/topp.mp4"></div>

this is my CSS:-

    .load{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    opacity: 1;
    background-color: #000000;
    animation: AnimateBg 10s linear infinite;
    transition:  all 0.5s ease-in-out;
}

@keyframes animateScale{
    0%{
        transform: scale(1);
    }

    100%{
        transform: scale(0); 
    }
}

@keyframes AnimateBg{
    0%{
        filter: hue-rotate(0deg);
    }
    100%{
        filter: hue-rotate(360deg);
    }
}

.load .loader{
    position: relative;
    width: 120px;
    height: 120px;
}

.load .loader span{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(calc(18deg * var(--i)));
}

.load .loader span::before{
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: #ffffff ;
    box-shadow: 0 0 10px #9B2335 ,
                0 0 20px #DFCFBE ,
                0 0 40px #55B4B0 ,
                0 0 60px #E15D44 ,
                0 0 80px #7FCDCD ,
                0 0 100px #C3447A ;
    animation: animateScale 2s linear infinite;
    animation-delay: calc(0.1s * var(--i));
}

.load-fin{
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

<img> Tag is only working with two (Image in Format like .png , .jpg ), (Or .gif file)

So if you need to add video inside your Site.. You must use <video> Tag like the examples below:

Video Example with Controls:

 <video width="400" controls> <source src="https://techcraze.co.in/wp-content/uploads/2021/03/topp.mp4" type="video/mp4"> Your browser does not support HTML video. </video>

Video Example without controls with autoplay feature:

 <video width="400" autoplay> <source src="https://techcraze.co.in/wp-content/uploads/2021/03/topp.mp4" type="video/mp4"> Your browser does not support HTML video. </video>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM