Categories: Tutorials

Create CSS3 Loading Rotating Image Icon

CSS3 is now being used widely to simplify task and to give quick better results. Today we are going to see how to create a rotating image or loading icon with CSS3 transform rotate property.

The first thing we are going to do is to create some loading image in photoshop. I just created one for this demo.

CSS3 Loading Rotating Circle Images

Now we are going to rotate this image with CSS3 properties.

Just create a simple html page and add following code to it.

<img id=”loading” src=”css3-loading-rotating-circle.png” />

It will create our image with id as loading. Now we will apply CSS3 properties to it.

Currently CSS3 is not supported in all browsers. So for using these properties in Mozilla Browser we need to add “-moz-” prefix to the property and for using these properties in Webkit Browser we need to add “-webkit-” prefix to the property.

Now create a style tag in your document and add following styles to it.

#loading
{
animation-name: myfirst;
animation-duration: 5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-play-state: running;
/* Firefox: */
-moz-animation-name: myfirst;
-moz-animation-duration: 5s;
-moz-animation-timing-function: linear;
-moz-animation-iteration-count: infinite;
-moz-animation-play-state: running;
/* Safari and Chrome: */
-webkit-animation-name: myfirst;
-webkit-animation-duration: 5s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-webkit-animation-play-state: running;
}
@keyframes myfirst
{
from {transform:rotate(0deg);}
to {transform:rotate(360deg);}
}

@-moz-keyframes myfirst /* Firefox */
{
from {-moz-transform:rotate(0deg);}
to {-moz-transform:rotate(360deg);}
}

@-webkit-keyframes myfirst /* Safari and Chrome */
{
from {-webkit-transform:rotate(0deg);}
to {-webkit-transform:rotate(360deg);}
}

Save your page and check it in Firefox, Safari or Google Chrome. If your browser doesn’t support CSS3 or if you are not able see it in action then check following video.


CSS3 Rotating Image, CSS3 image rotation with CSS3 Transform Property

In the above code

animation-name

Property specifies the name of the function we are going to execute.
and with

@keyframes myfirst

function we are specifying to rotate that circle from 0 deg to 360 deg.

With

animation-duration

property we are specifying the time duration in which animation should be completed. If you want to rotate circle fast then reduce this timing from 5 seconds (5s) to 2 seconds (2s).

And with

animation-iteration-count

property we are making it to rotate continuously.

TRY A DEMO of CSS3 Loading Rotating Image Icon

ProWebGuru

Mostly I write about technology related stuff on https://www.prowebguru.com Recently I have started making videos also. Mostly blog posts & videos are related to technology, programming and learning some new tips and tricks related to windows, wordpress, google app script, technical, programming, javascript, jquery and other coding related stuff. Youtube channel - https://www.youtube.com/user/prowebguru

View Comments

  • thank you so much, this is very helpfull in making my website.
    could you please help me out with the following, i am sure this is easy for you.
    i would like the picture to rotate when i click the picture.

Recent Posts

GPT 5.4: Powerful AI Breakthrough – 7 Game-Changing Features, Launch Date & Full Guide

GPT 5.4: The Next-Generation AI Model Transforming Reasoning, Coding, and Productivity Artificial Intelligence is evolving…

1 day ago

GPT‑5.3 Instant Explained: Faster, Smarter & Fewer Refusals

GPT-5.3 Instant is OpenAI's latest ChatGPT model update, prioritizing smoother conversations, fewer refusals, and higher…

2 days ago

Free Perplexity Pro for Airtel Customers: Unlock Advanced AI Assistance at No Cost!

Are you tired of scrolling endlessly through Google results trying to find clear, trustworthy answers?…

4 months ago

Unlocking Collaborative Coding with GitHub Copilot Spaces

In recent years, the process of software development has rapidly evolved—developers demand smarter tools and…

4 months ago

ChatGPT Go Now Free in India: Opening Doors to Advanced AI Capabilities

India has emerged as one of the fastest-growing and most significant markets in the global…

4 months ago

AgentKit by OpenAI: Redefining the Future of AI Agent Development

On October 6, 2025, OpenAI unveiled AgentKit, a unified suite of tools designed to help developers and…

5 months ago

This website uses cookies.