Simple Loader v8 || Loading Animation || Web Designing





Step 1: Markup (HTML)


<body>
<div class="base">
  <div class="chars one">L</div>
   <div class="chars two">O</div>
   <div class="chars three">A</div>
   <div class="chars four">D</div>
   <div class="chars five">I</div>
   <div class="chars six">N</div>
   <div class="chars seven">G</div>
   <div class="chars eight">.</div>
   <div class="chars nine">.</div>
   <div class="chars ten">.</div>
  </div>
</body>

This HTML code represents a webpage's structure. Inside the `<body>` element, there is a `<div>` element with the class "base." Inside this "base" div, there are ten more `<div>` elements, each with a different class ("one" through "ten"). These inner divs seem to represent individual characters, where "L," "O," "A," "D," "I," "N," "G," and three dots ("...") are displayed sequentially. This code likely creates a visual representation of the word "LOADING..." on a webpage using HTML and CSS styling.


Step 2: Set some initial CSS rules in <style> tag:-


*, *::after, *::before{
 padding: 0;
 margin: 0;
box-sizing: border-box;
}

This code snippet is written in CSS, a language used for designing the appearance of web pages. In simple terms, this code sets some basic rules for all elements on a web page. The symbols "*", "*::after," and "*::before" represent all elements, including any additional content that might be added after or before the main content of an element. The code inside the curly braces defines three rules: it sets the padding (empty space inside an element), margin (space outside an element), and box-sizing (how the total width and height of an element is calculated) to be "border-box," which means these properties are included within the element's total width and height. This rule helps ensure consistent and predictable spacing and sizing for all elements on the webpage.


Step 3: Style <body> tag:-


body{
height: 100vh;
 display: flex;
 align-items: center;
 justify-content: center;
}

This code is used in a webpage to style the body element, which is the main container for all the content on the page. It sets the height of the body to take up the entire vertical height of the user's screen (100vh). It also uses a flexible layout with the display property set to "flex," which means that the content inside the body will be organized in a flexible way. The "align-items" property centers the content vertically, so it appears in the middle of the screen, and the "justify-content" property centers it horizontally, so it's in the middle of the screen horizontally as well. Essentially, this code centers the content on the webpage both vertically and horizontally, making it look neat and centered on the user's screen.


Step 4: Create a base for loader:-


.base{
height: 250px;
 width: 250px;
 display: flex;
 align-items: center;
 justify-content: center;
}

This code defines a CSS class called ".base." This class is used to style elements in a web page. It sets the height and width of these elements to 250 pixels each, making them square. It also uses the "display: flex;" property to make the content inside these elements aligned both vertically and horizontally. This means that any text or other content placed inside an element with this class will be centered both vertically and horizontally within the element. So, it's a simple way to create centered, square containers for content on a web page.


Step 5: Style all characters at once:-


.chars{
font-size: xxx-large;
 animation-name: slide;
 animation-duration: 2s;
 animation-delay: var(--delay);
 animation-timing-function: linear;
 animation-iteration-count: infinite;
}

This code is for styling a group of elements with a CSS class called ".chars." It makes the text inside these elements appear very large with the "font-size" property set to "xxx-large." It also adds animation effects to the text. The animation is named "slide" and lasts for 2 seconds with a delay specified by a custom variable called "--delay." The animation moves the text smoothly at a constant speed ("linear") and keeps repeating infinitely, so the text keeps sliding and doesn't stop. This code is useful for creating eye-catching and dynamic text effects on a webpage.


Step 6: Set delay and colors individually:-


.one{
  color: red;
    --delay : 0ms;
   }
   .two{
     color: green;
     --delay : 100ms;
   }
   .three{
     color: blue;
     --delay : 200ms;
   }
   .four{
     color: maroon;
     --delay : 300ms;
   }
   .five{
     color: orange;
     --delay : 400ms;
   }
   .six{
     color: yellowgreen;
     --delay : 500ms;
   }
   .seven{
     color: blueviolet;
     --delay : 600ms;
   }
   .eight{
     --delay : 700ms;
   }
   .nine{
     --delay : 800ms;
   }
   .ten{
     --delay : 900ms;
 }

This code is defining the styles for ten different elements using CSS. Each element has a class name (like ".one", ".two", etc.) and a specific color assigned to it (e.g., "red", "green", "blue", etc.). Additionally, each element has a custom property called "--delay" with values in milliseconds (e.g., "0ms", "100ms", "200ms", etc.). Essentially, this code sets up styles for elements on a web page, specifying their colors and optionally, a delay property that could be used for animations or other purposes in the future.


Step 7: Set keyframes:-


@keyframes slide {
  0%{
    transform: translateY(0px);
   }
   10%{
     transform: translateY(-20px);
   }
   20%{
     transform: translateY(0px);
   }
 }

This code defines a set of instructions for animating an element on a webpage. It's written in a special language called CSS, which is used to style and layout web content. The code is using something called "keyframes" to create a smooth animation. The animation is named "slide." It tells the element to start at its current position (0%) and then move upward by 20 pixels over a short period of time (10%). After that, it returns to its original position (20%). So, when you apply this animation to an element in your webpage, it will appear to slide up and down in a repeating loop, creating a simple bouncing effect.


---END---

Comments