<input type="checkbox" />
<div></div>

<footer>
	<p>Demo 4/4 for <a href="https://brm.us/animated-gradient-border" target="_top">https://brm.us/animated-gradient-border</a></p>
	<p>Don't see an animation? That's because your browser does not support <code>@property</code>.<br />Check out <a href="https://codepen.io/bramus/pen/XWMwPgO" target="_top">this forked version</a> which includes a fallback for your browser.</p>
</footer>
div {
	--angle: 0deg;
	width: 50vmin;
	height: 50vmin;
	border: 10vmin solid;
	border-image: conic-gradient(from var(--angle), red, yellow, lime, aqua, blue, magenta, red) 1;
	
	animation: 10s rotate linear infinite;
}

@keyframes rotate {
	to {
		--angle: 360deg;
	}
}

@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}















input[type="checkbox"] {
	position: fixed;
	top: 1em;
	left: 1em;
}

input[type="checkbox"]:after {
	content: 'Toggle Fill';
	white-space: nowrap;
	padding-left: 1.5em;
}

input[type="checkbox"]:checked + div {
	border-image-slice: 1 fill;
}

html {
	background: #fff;
}

body {
	margin: 0;
	padding: 0;
	height: 100vh;
	width: 100vw;
	display: grid;
	place-items: center;
}

footer {
	text-align: center;
	font-style: italic;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.