.custom-btn {
background: linear-gradient(105deg,
/* Base gradient stops */
#f6d365, #fda085, #f6d365, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3,
/* Repeat your base gradient stops */
#f6d365, #fda085, #f6d365, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3,
/* Repeat your first gradient stop */
#f6d365);
background-size: 200% 200%;
animation: rainbow 5s linear infinite;
border: 0;
padding: 25px;
font-size: 40px;
color: #fff;
}
@keyframes rainbow {
0% { background-position: 100% 100% }
100% { background-position: 0% 0% }
}
<body style="text-align:center;">
<button class="custom-btn">My Button</button>
</body>