How to create Amazing Skeleton Loading | HTML & CSS Project - Frontend everything
Hello Everyone 👋 Welcome to My New Blog. Today I have made an Amazing Skeleton Loading with the help of HTML and CSS Only! 😍
I am Piyush, Sharing About Web development Daily. You can also check out me at @frontendeverything.
Before starting the blog, you might think about where you can use this project in real-life-based projects. So it's an Amazing Skeleton Loading that you can use in your own blog project. So it will look attractive.
Let's start making these amazing Skeleton Loading Using HTML & CSS step by step.
Video of the project,
So that was the preview now let us start making the project 😄 First, we will code HTML then CSS, and also I have shared codepen ink to make it easier for you.
HTML 🎈( step - 1)
In HTML we have used divs for container.
<div class="container">
<!-- code here -->
<div class="card">
<div class="card-img skeleton">
<!-- waiting for img to load from javascript -->
</div>
<div class="card-body">
<h2 class="card-title skeleton">
<!-- wating for title to load from javascript -->
</h2>
<p class="card-intro skeleton">
<!-- waiting for intro to load from Javascript -->
</p>
</div>
</div>
<div class="card">
<div class="card-img">
<img src="https://assets.codepen.io/285131/uslmOwQpdRRUwr6AmBP6JdzeHjS.jpg" />
</div>
<div class="card-body">
<h2 class="card-title">
Drive (2011)
</h2>
<p class="card-intro">
Driver is a skilled Hollywood stuntman who moonlights as a getaway driv...
</p>
</div>
</div>
</div>
After the HTML we will design the Skeleton Loading with CSS..
Output till now
CSS🎈( step - 2)
*, *:after, *:before {
box-sizing: border-box;
}
body {
font-family: "Inter", sans-serif;
background-color: #f2f5f7;
}
.card {
display: flex;
flex-direction: column;
flex-basis: 300px;
flex-shrink: 0;
flex-grow: 0;
max-width: 100%;
background-color: #FFF;
box-shadow: 0 5px 10px 0 rgba(0, 0, 0, 0.15);
border-radius: 10px;
overflow: hidden;
margin: 1rem;
}
.card-img {
padding-bottom: 56.25%;
position: relative;
}
.card-img img {
position: absolute;
width: 100%;
}
.card-body {
padding: 1.5rem;
}
.card-title {
font-size: 1.25rem;
line-height: 1.33;
font-weight: 700;
}
.card-title.skeleton {
min-height: 28px;
border-radius: 4px;
}
.card-intro {
margin-top: 0.75rem;
line-height: 1.5;
}
.card-intro.skeleton {
min-height: 72px;
border-radius: 4px;
}
.skeleton {
background-color: #e2e5e7;
background-image: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
background-size: 40px 100%;
background-repeat: no-repeat;
background-position: left -40px top 0;
-webkit-animation: shine 1s ease infinite;
animation: shine 1s ease infinite;
}
@-webkit-keyframes shine {
to {
background-position: right -40px top 0;
}
}
@keyframes shine {
to {
background-position: right -40px top 0;
}
}
.container {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
}
Now we have done the CSS coding as well, now we will see the final output and also check the codepen link mentioned below.
Final Output
The codepen link is here for making your work easier!
.
If you found any value in this blog you can support me by buying me a coffee.
.
.
.
.
.
Thank You For Scrolling Till here 😊. If You gain any knowledge then do checkout me at @frontendeverything. I am Piyush 🎉 I provide Content related to programming, technology, web development Daily.
.