why this css animation not working? -
could please tell me why animation not working in code?
.alltopics { height: 100px; width: 100%; background: linear-gradient(135deg, #ff3300, #cc00cc); animation: topicbackground 10s ease infinite; } /* safari 4.0 - 8.0 */ @-webkit-keyframes topicbackground { 0% { background-position: 0% 50%;} 50% { background-position: 100% 50%;} 100% { background-position: 0% 50%;} } /* standard syntax */ @keyframes topicbackground { 0% { background-position: 0% 50%;} 50% { background-position: 100% 50%;} 100% { background-position: 0% 50%;} } <div class="alltopics"></div> the goal make div have gradient background , animate between 2 colours , forth.
you're trying animate background-position won't work linear gradient. it's not image, therefore doesn't have background-position.
unfortunately there's no straight-forward way animate gradients in css, can check out this tutorial workarounds.
edit
after discussion in comment can apparently make work using background-size property value that's above 100%, background-size: 400% 400%.
Comments
Post a Comment