<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="./style.css">
    <title>Rotating coloured border</title>
</head>
<body>
    <div class="box"></div>
</body>
</html>
body {
    width: 100vw;
    height: 100vh;
    background-color: #111;
    display: flex;
    justify-content: center;
    align-items: center;
}

.box {
    width: 400px;
    height: 250px;
    background-image: linear-gradient(40deg, #0000ff, #00ffff, #ff0000, #ff0099, #ffffff,#00ffff, #ffff33, #00ff33, #ff0099);
    background-size: 200%;
    animation: flashy 10s linear infinite;
    display: flex;
    justify-content: center;
    align-items: center;
}

.box:before {
    content: '';
    width: calc(100% - 2px);
    height: calc(100% - 2px);
    background-color: #111;  
}

@keyframes flashy {
    0% {
        background-position: 0 0;
    }
    33% {
        background-position: 500% 0;
    }
    66% {
        background-position: 0 0;
    }
    100% {
        background-position: 500% 0;
    }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.