Obtaining a background image within a keyframe

I have been experimenting with keyframe animations and am looking to incorporate multiple images into the animation. Specifically, I want to switch out the image every 10% increment to depict someone running.

Despite my efforts to use a background-img in my demo, the image is not displaying at all. I searched for solutions but only came across outdated information from 2013 claiming it wasn't possible. However, I believe advancements may have been made in the past three years that could make this feasible.

If changing the image every 10% is not achievable, what alternative method would you suggest I explore?

Here is the code snippet I have been working on:

div {
    width: 100px;
    height: 100px;  
    background-image: url("http://optimumwebdesigns.com/images/brain.jpg");  
    position: relative;  
    -webkit-animation-name: example; /* Chrome, Safari, Opera */  
    -webkit-animation-duration: 4s; /* Chrome, Safari, Opera */  
    -webkit-animation-iteration-count: 3; /* Chrome, Safari, Opera */  
    -webkit-animation-direction: normal; /* Chrome, Safari, Opera */ 
    animation-name: example; 
    animation-duration: 10s; 
    animation-iteration-count: 3; 
    animation-direction: normal;
}  
/* Chrome, Safari, Opera */
@-webkit-keyframes example {  
    0%   {background-color:red; left:0px; top:0px;}  
    25%  {background-color:yellow; left:500px; top:0px;}  
    50%  {background-color:blue; left:500px; top:200px;}  
    75%  {background-color:green; left:0px; top:200px;}  
    100% {background-color:red; left:0px; top:0px;}
}

/* Standard syntax */
@keyframes example {  
    0%   {background-color:red; left:0px; top:0px;}  
    25%  {background-color:yellow; left:500px; top:0px;}  
    50%  {background-color:blue; left:500px; top:200px;}  
    75%  {background-color:green; left:0px; top:200px;}  
    100% {background-color:red; left:0px; top:0px;}
}
<div></div>

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

Which file extension is superior for SEO: .html, .php, or .aspx?

Which file extension is more SEO-friendly: .html, .php, or .aspx? Or is an extension-less URL the best option for SEO? ...

Evaluation of HTML5 file upload functionality with unit testing

How can I perform JavaScript unit testing for file uploads using the HTML 5 File API? Let's consider the following code: <form method="POST" enctype="multipart/form-data"> <input type="file" id="fileselec ...

Having trouble with the JQuery scrollTop animation? Getting the error message "Cannot read property 'top' of undefined"?

I am having trouble with my jquery animation scrollTop function. Whenever I click on <a>, it takes me to the anchor without any animation. Can someone please provide a solution for this issue? Upon running the webpage, I encountered an error message ...

Images are not visible when scrolling horizontally

Hello everyone, this is my first time reaching out with a question here! I've been working on setting up a horizontal scroll feature and I'm almost there, but I'm encountering an issue where the scroll bar is appearing at the bottom of the ...

Make IE10 HTML page use IE Quirks mode

Assist me, I'm battling with Internet Explorer. We have a series of pages that function well in IE8 (on our intranet). The company has made the decision to upgrade directly to IE10. What is the HTML code needed to force a page to use IE5 Quirks Mode ...

Embracing New and Returning Users with Jquery Cookies: A Guide on Making Every User Feel Welcome

I'm currently working on setting up a Welcome page for both new and returning users using cookies with jQuery. However, I've encountered an issue where upon submitting the form with new user data, the message displayed is not "Welcome New User," ...

Is it possible for CSS to automatically style paragraphs based on the preceding heading class?

Looking to create some unique CSS rules for formatting interview transcripts. The format I have in mind is as follows: <h2 class="interviewer">Alice: [00:00:00]</h2> <p>Is it ok if I ask you a question now?</p> <h2 class="inter ...

Incorporate an external JavaScript script using code

I'm currently working on integrating a map widget from 'Awesome Table' into the codebase of an open-source CRM platform. The specific code snippet I need to add is <div data-type="AwesomeTableView" data-viewID="-KLtnY5OHJPgnEOX1bKf"> ...

What are some possible applications for leveraging the HTML5 <link rel> attribute duo of stylesheet and next?

The specification for HTML5 emphasizes the handling of each link created within a link element as separate entities. This means that multiple link elements with `rel="stylesheet"` are treated independently, considering them as distinct external resources a ...

Customizing Body Color in CKEditor for Dynamic Designs

I am facing an issue with CKEditor that I am hoping to find a solution for. My scenario involves using a jQuery color picker to set the background color of a DIV element, which is then edited by the user in CKEditor. However, I have observed that it is not ...

When an element within a dropdown is hovered over, a dropdown menu is triggered

As a newcomer to Web Development, I am facing a fundamental issue with my bootstrap navigation bar. The navigation bar contains multiple dropdown buttons that activate on hover. One of the buttons within a dropdown needs another dropdown to appear when hov ...

Using JQuery to fill an HTML dropdown menu with data from a JSON file

I've been struggling with this issue for a while and despite reading through other posts, I still can't seem to get it to work. My problem lies in populating a drop down menu with JSON data. Although the drop down menu appears on my HTML page, i ...

"Opt for a horizontal WordPress drop-down menu instead of the typical vertical layout

I am looking to customize a menu in WordPress by creating a horizontal drop-down menu instead of the default vertical layout. An example of what I am aiming for can be seen on this website. If you hover over OUR SECTORS, you will see the type of menu I am ...

What is the best way to ensure that all the divs within a grid maintain equal size even as the grid layout changes?

I have a grid of divs with dimensions of 960x960 pixels, each block is usually 56px x 56px in size. I want to adjust the size of the divs based on the changing number of rows and columns in the grid. Below is the jQuery code that I am using to dynamicall ...

Guide to setting up a custom js file in Laravel admin template

Currently working with Laravel 5.8 and utilizing the laravel-admin Template for administrative purposes. There are times when I require custom JavaScript and CSS files specifically for certain admin controllers. How can I include these JS and CSS in lara ...

Incorporating a clickable button over a video

I've exhausted all available resources trying to figure this out and have hit a dead end. My goal is to place a button on top of the video, but my lack of CSS expertise is hindering me. Can someone please help me identify what I'm doing wrong wit ...

Using both PHP $_POST and $_GET in a form submission for enhanced functionality

My preferred programming language is PHP. I am currently working on a form and once it is submitted, I want it to redirect to a specific URL with a $_POST variable attached at the end (formatted as a $_GET), for example: http://example.com/page.php?my_ke ...

Is there a way to emphasize a particular day on the calendar obtained from the URL?

I have implemented FullCalendar functionality to enable users to select a specific date, retrieve data from a database, and then reload the page with that data. The page is updated with the selected date in the URL. However, when the page reloads, althoug ...

The total height of the document's body in jQuery is not equal to the sum of the viewport height and the window's scroll top position at the bottom of the document

Why does the document height appear smaller than the window scroll top value plus the viewport height when I reach the end of the document? Shouldn't they be equal? I've been struggling with this issue for hours and can't seem to figure it o ...

Is it necessary to set required input if the db column can be NULL?

Is there a way to dynamically add the "required" attribute (HTML5) to an input if the chosen column cannot be null in PHP? Here's an example of what I'm trying to achieve: $result = mysqli_query($db, "SELECT * FROM table"); while($row = mysqli ...