Skeleton Loader CSS With Angular

Many of us hope to improve user experience by displaying loaders and spinners while users wait for a page to be loaded due to some server to client communication, promises to be resolved or basically any function waiting to be executed or data waiting to be retrieved from the server before finally rendering the page to the user.

I personally think skeleton screens give the illusion of “it’s almost about to show” while loaders and spinners make it feel like “it’s trying to show hopefully” that is why you find Facebook, Slack, LinkedIn and Co using skeleton screens.

The idea is, Whenever someone requests new content from the server, you can immediately start showing the skeleton, while data is being loaded in the background. Once the content is ready, simply swap the skeleton for the actual card. This can be done with plain vanilla JavaScript or using a library like Angular, React, Vue etc.

Now you could use an image to display the skeleton, but that would introduce an additional request and data overhead. We’re already loading stuff here, so it’s not a great idea to wait for another image to load first. Plus it’s not responsive, and if we ever decided to adjust some of the content card’s styling, we would have to duplicate the changes to the skeleton image so they’d match again.

Check Out What It Takes To Build A Successful App Here

What I observe is –

  • Skeleton screens are somewhat novel and attract more attention than the ubiquitous loading spinner.
  • Skeleton screens work better in familiar interfaces and can be off-putting in new settings when users don’t know what to expect.
  • Skeleton screens work best when wait times are very short.

Lets Code –

  • Create a new angular project, Add Bootstrap framework for faster & responsive design into the index.html file.
  • Do not forget to add BrowserAnimationsModule into app.module.ts ‘s “imports[]”.
  • Add the layout you want also it’s CSS.
  • CSS pseudo class – :empty pseudo can be used to preserve the loading effect on any of the layout elements without children. Children can be either element nodes or text (including whitespaces).






animation: loading 1.1s infinite linear;

background: #dedfe1;

background-image: -webkit-linear-gradient(to right, #dedfe1 0%, #f2f3f5 20%, #dedfe1 40%, #dedfe1 100%);

background-image: linear-gradient(to right, #dedfe1 0%, #f2f3f5 20%, #dedfe1 40%, #dedfe1 100%);

background-repeat: no-repeat;

  • Structural Derivative – *ngIf will be used to switch from the skeleton layout to the original layout once our asynchronous request has been fulfilled.
  • To get a loading effect on every element of our skeleton layout, we will make use of the linear-gradient CSS property which provides a smooth transition between colors. Angular provided a method called ‘transition()’.The transition() function accepts two arguments:

We Build Streamlining Accreditation Process For Physicians

The first argument accepts an expression that defines the animation states or the direction between two transition states, and the second argument is an array that accepts some set of parameters like animate(), style() e.t.c.The animate() is similar to the animate CSS property while style() will contain the CSS styles for the animation states.

  • Using CSS animation property and @keyframes rule will enable us to gradually change from a set of CSS styles to another. The @keyframes rule specifies the animation code. The animation is created by gradually changing from one set of CSS styles to another, you can change the set of CSS styles many times.
@keyframes loading {

0% {

background-position: -100px;


100% {

background-position: 200px;



Check out the stackblitz demo here –

StackBlitz Demo



I am hoping this article will help you to understand the aspects of skeleton screen loading animation. To discuss more about the concept of css skeleton loading, share your queries in the comment section.

Get Wide Array Of Angular JS Development Services Tailored To Your Needs

Keep Reading

Keep Reading

Leave your competitors behind! Become an EPIC integration pro, and boost your team's efficiency.

Register Here
  • Service
  • Career
  • Let's create something together!

  • We’re looking for the best. Are you in?