Animating with linear gradients isn't my strong suit

I attempted to create an animated effect that involves a Tilted & Jump movement across the screen, but unfortunately, the gradient feature is not functioning properly.

This is the code I used:

<!DOCTYPE html>
<html>
<head>
  <style>
    img {
      width:100px;
      height:100px;
      background: linear gradient(red,yellow);
      color: #ffffff;
      position: relative;
      font-weight:bold;
      font-size:20px;
      padding:10px;
      border-radius:5px;
      animation:animated_div 5s 5;
      -webkit-animation:animated_div 5s 1;
         -moz-animation:animated_div 5s 1;
           -o-animation:animated_div 5s 5;
                -webkit-border-radius:5px;
    }

    @keyframes animated_div {
      0% {transform: rotate(0deg);left:0px;}
      12.5% {transform: rotate(20deg);left:0px;}
      25% {transform: rotate(0deg);left:500px;}
      27.5% {transform: rotate(0deg);left:500px;}
      35% {transform: rotate(0deg);left:500px;background:-webkit- linear-    gradient(red,yellow);}
      50% {transform: rotate(-360deg);left:0px;}
      62.5% {transform: rotate(0deg);left:0px;}
      77.5% {transform: rotate(20deg);left:0px;}
      80% {transform: rotate(0deg);left:500px;}
      90% {transform: rotate(0deg);left:500px;}
      95% {transform: rotate(0deg);left:500px;background:-webkit-linear-    gradient(Yellow,Red);}
      100% {transform: rotate(-360deg);left:0px;}
    }
    body{background-color:black;}
  </style>
</head>
<body>
  <img class="q" src="https://pbs.twimg.com/media/C3dJvIZUEAAkIjg.png">
</body>
</html>

However, the border gradients are not displaying as intended.

Answer №1

A hyphen is crucial to include in the syntax of linear-gradient.

The corrected line should look like this:

background: linear-gradient(red, yellow);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a way to dynamically expand and collapse all table rows, with the latest row always remaining visible, using pure JavaScript?

I have a form input field where I enter data. The entered data is then displayed in a table as a new row, with the most recent entry at the top. What I want to achieve is to show only the newest row in the table and hide all other rows. When I hover over ...

Positioning Images in Tables with Absolute CSS Styling

I need to alternate between two sets of images using JavaScript. To achieve this, I have to use CSS to set the position of each image to absolute so that each new image replaces the old one as it cycles through. My goal is to arrange the image sets in an ...

Warning: An error occurred with undeclared variables... missing variable declaration

Hey everyone, I recently made a post but it seems like my explanation was not clear enough. So here's the issue - I have a products page with a URL structure like http:.......rest_id=3/area='Enfield'. I've been using a similar query on ...

Tip: Using jQuery to Wrap Characters Based on Count

Within my table, there is a specific cell in each row that contains exactly 13 characters. <td class="need-to-wrap">0123456789012</td> I am looking to wrap characters #10, 11 and 12 with a span element like so: <td class="need-to-wrap"> ...

Reposition the div element on mobile devices using media queries

Hello, I'm facing an issue on mobile with my website: dev site Today, I implemented a dropdown menu with flags to allow language switching. However, the dropdown in mobile is appearing under the hamburger nav bar. I was thinking of using media querie ...

Expand the image background to fit within a div container

Below is the code snippet I am working on: <div id="intro_section_upper" > <%= image_tag("video_background.jpg", :id=>"video_bg") %> <div id="video_table_main" > <table class=" ...

Steps for bringing the image to the front and changing the background color to black

I am trying to create a function where a button calls the ID image. However, I want the background div image to be unclickable and for the image to appear in front of all other divs when the page is loading. What CSS style should I add to achieve this? ...

Revamping Footer Text

Hey there, I'm feeling a bit inexperienced with this question, so after struggling on my own for a while I decided to turn to stackoverflow for help. So, I have a website located at , and at the very bottom of the page there's some copyright inf ...

Encountered an issue when executing python manage.py migrate and python manage.py runserver

form.py This is the form section. from django.contrib.auth.models import User from security_app.models import UserProfileInfo from django import forms class UserForm(forms.ModelForm): password = forms.CharField(widget=forms.PasswordInput()) ...

I am interested in updating the color of the navigation bar displayed on this website

I am having some trouble with manipulating the appearance of - Specifically, I'm struggling to change the color of the black bar at the top to blue. I have scoured the CSS files and examined the HTML, but I can't seem to locate the relevant code ...

Is it possible to vertically displace an element within a CSS Grid cell?

Here is the code snippet: .grid-container { display: grid; grid-template-columns: auto auto auto; background-color: #2196F3; padding: 10px; } .grid-item { background-color: rgba(255, 255, 255, 0.8); border: 1px solid rgba(0, 0, 0, 0.8); ...

How can I use handlebars to display a video when the user clicks on an image?

I'm currently working on a webpage where I want to be able to show a hidden video when the user clicks on an image tag. I've implemented this using handlebars. Additionally, I want the video to close when the user clicks on another photo. < ...

Looking for assistance with my website's navigation bar and logo

Looking for assistance in moving my navigation buttons to each side of the logo. As a beginner in web design and CSS, I've been struggling with this task. Essentially, I want the "home" and "about" buttons on the left side of the logo, 16px apart from ...

What method can be used to obtain a parallel vector on a plane that has been struck by an intersecting ray?

Issue at hand: https://i.sstatic.net/H5g5M.jpg Given parameters: intersect, n, p. With p representing a random point in the space, and N as the normal of the plane. Desired result: w Approach attempted in my shader code: "vec3 n = normalize(faceNormal ...

The file you are trying to import, bootstrap-sass, cannot be located or is unreadable

Experimenting with Django Shop and following a tutorial that can be found here: (stable version). After starting the server and navigating to localhost, the following error message is displayed: Error: File to import not found or unreadable: bootstrap-s ...

Displaying ember component in a separate template from its parent

Consider this scenario: I have an absolutely positioned sidebar containing additional absolute elements. Within the sidebar, there is a button that triggers a menu to appear: <button>Click me</button> {{#if shouldDisplayMenu}} {{view App.M ...

Maintaining a Multi-page template in PhoneGap: Best practices

I'm a beginner in Hybrid app development, currently using PhoneGap and Jquery Mobile. In my app, I have around 10 separate pages such as login.html, index.html, search.html, etc. My query is whether I should include all JS and CSS files on each indivi ...

"How to change the hover background of a select element in Chrome from its default setting to something else

https://i.sstatic.net/G2deM.png Is there a way to remove the background color on hover and replace it with a different color? .drp-policydetails { border: 1px solid #dddddd; background-color: #ffffff; } <div className="form-group"> <sele ...

Unexpected Placement of CSS Grid Items

I am currently facing an issue with aligning items in a nested grid using grid-column/grid-row assignment. After setting the template with grid-template-rows:/grid-template-columns, I expected the $50 and Give Now items to appear on row 3, with one in colu ...

A guide on styling JSON key values within HTML

I need help organizing my JSON Document on an HTML page. Here is the JavaScript code I am using: xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { // Optionally, here you can update ...