Rotating Boarder Animation

Home / Web Code Snippet / Rotating Boarder Animation

Rotating Boarder Animation


https://youtube.com/shorts/XOhU_aKLExs?si=a3Zw-RE9SjWjV1OG

HTML CODE:-

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
</head>
<body>
    <div class="container">
        <img src="https://media.istockphoto.com/id/904172104/photo/weve-made-it-all-this-way-i-am-proud.jpg?s=612x612&w=0&k=20&c=MewnsAhbeGRcMBN9_ZKhThmqPK6c8nCT8XYk5ZM_hdg=">
    </div>
</body>
</html>

CSS CODE:-

        body{
    padding: 0px;
    margin: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: black;
}
.container{
    width: 150px;
    height: 150px;
    border-radius: 50%;
    padding: 10px;
    border-top: 2px dashed green;
    border-right: 2px dashed yellow;
    border-left: 2px dashed red;
    border-bottom: 2px dashed blue;
    animation: animate 8s linear infinite;
}
img{
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    animation: animate 8s infinite reverse linear;
}
@keyframes animate{
    100%{
        transform: rotate(360deg);
    }
}