A guide on rotating loaders and inserting custom text within loaders using CSS

Seeking assistance to modify my code for creating a unique loader design. The inner loader needs to remain static with only top and bottom segments, while the middle loader rotates anti-clockwise and the outer loader rotates clockwise. Additionally, the word "POLYU" should be included in the center of the inner loader. As I am new to coding, any help or guidance would be greatly appreciated.

body {
    margin: 0;
    padding: 0;
    background-color: black;
}

.outerLoader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    border: 2px solid black;
    border-bottom: 2px solid yellow;
    border-radius: 50%;
    box-sizing: border-box;
    color: white;
    animation: outerAnimate 3s linear infinite;
}

.middleLoader {
    content: ' ';
    position: absolute;
    top: 10px;
    left: 10px;
    bottom: 10px;
    right: 10px;
    border: 2px solid black;
    border-bottom: 2px solid red;
    border-radius: 50%;
    animation: middleAnimate 4s linear infinite;
}

.innerLoader {
    content: ' ';
    position: absolute;
    top: 22px;
    left: 22px;
    bottom: 22px;
    right: 22px;
    border: 2px solid black;
    border-bottom: 2px solid blue;
    border-top: 2px solid blue;
    border-radius: 50%;
    animation: static;
}

@keyframes outerAnimate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes middleAnimate {
    0% {
        transform: rotate(360deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

Answer №1

The transform property is used in both the class and animation. Therefore, the normal transform translate is overridden by the animation's transform.

body {
    margin: 0;
    padding: 0;
    background-color: black;
    width: 100vw;
    height: 100vh;
}
body, .outerLoader, .middleLoader, .innerLoader {
    display: flex;
    justify-content: center;
    align-items: center;
}
.outerLoader {
    width: 200px;
    height: 200px;
    border: 2px solid black;
    border-bottom: 2px solid yellow;
    border-radius: 50%;
    box-sizing: border-box;
    color: white;
    animation: outerAnimate 3s linear infinite;
}

.middleLoader {
    width: 160px;
    height: 160px;
    border: 2px solid black;
    border-bottom: 2px solid red;
    border-radius: 50%;
    transform: rotate(180deg);
    animation: middleAnimate 4s linear infinite;
}

.innerLoader {
    width: 120px;
    height: 120px;
    border: 2px solid black;
    border-bottom: 2px solid blue;
    border-top: 2px solid blue;
    border-radius: 50%;
    transform: rotate(180deg);
    animation: innerAnimate 6s linear infinite;
}
@keyframes outerAnimate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes middleAnimate {
    0% {
        transform: rotate(180deg);
    }
    100% {
        transform: rotate(-540deg);
    }
}
@keyframes innerAnimate {
    0% {
        transform: rotate(180deg);
    }
    100% {
        transform: rotate(540deg);
    }
}
<div class="outerLoader">
<div class="middleLoader">
<div class="innerLoader">
POLYU
</div>
</div>
</div>

<!-- begin snippet: js hide: false console: true babel: false -->

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

The onclick handler fails to function following the injection of html using jquery AJAX

After using ajax to inject HTML into my page, the onclick handler on a specific part of that injected HTML does not seem to be functioning... Specifically, I am referring to this image... < img class="close_row" src="img/close.gif"/> In jQuery, I ...

What steps should I take to ensure that jQuery functions remain functional on loaded code?

I have implemented modals on all my pages except for the first one to save time. Here is the script that loads my modals: $(function () { $('#header').load('reusenavbar.php'); $('#loginModal').load('reuseloginmo ...

Instructions on creating a simple text-based menu and sub-menu without any images or graphics

I'm currently working on implementing a drop-down menu for my website, which can be found at The menu I am trying to create should appear under the Health & Fitness and Gaming sections as a text-only drop-down. I've been experimenting with s ...

Display the item with jQuery once the CSS generated by jQuery has finished loading

Is it possible to delay the visibility of an object until my script finishes loading? I tried using ajaxcomplete() and ajaxSuccess() without success. Check out the code snippet below for an example. There's an image with the id: imagefocus. Whenever ...

Move the footer down to the bottom of the page

I'm struggling to create a footer that consistently stays at the bottom of the page, regardless of the amount of content on the page. I've tried following various tutorials but haven't had much success. I'm starting to think I must be d ...

Demystifying Vertical Alignment: Everything You Need to Know

Struggling with vertical alignments has proven to be more complicated than expected. Despite reading numerous resources on stackexchange, a common understanding of the process remains elusive. After gathering some guidelines, it turns out that vertical-al ...

The Bootstrap row does not display divs in a stacked formation when viewed on smaller screens

My layout is using bootstrap rows for two divs. I want them to be side by side on large devices, but stacked on small devices. However, Bootstrap is not stacking them on small devices and they are still both sitting at 50%. The specific divs I am talking ...

Unable to conceal HTML5 video in mobile devices through media query

I've been struggling to find a solution for hiding a video on mobile devices. Despite going through numerous posts and attempting different methods, I haven't been successful in using @media queries to hide the video and show an image instead. He ...

Security Error when using the JavaScript map function in FireFox

My current dilemma involves using a JavaScript code to extract the above-the-fold CSS from my websites. Surprisingly, it functions flawlessly on Google Chrome. However, when I attempt to execute it on Firefox, an infamous 'SecurityError' occurs: ...

How can we create lists using parentheses specifically with Javascript or jQuery?

I am looking to create a formatted list using <ol> and <ul> tags with parentheses included. (1) List1 (2) List2 (3) List3 (4) List4 The challenge is to achieve this formatting purely with javascript or jQuery, without relying on any external ...

The aesthetic of react-bootstrap and material ui aesthetics is distinctive and visually appealing

As I develop my web application, I have incorporated react-bootstrap for its React components based on Bootstrap. However, wanting to give my project a customized look inspired by Material design, I came across bootstrap-material-design. I am curious if I ...

Can CSS be used to modify the size of the clickable region for links?

I'm currently working on a code block that resembles the following: <p class="cont"> <a href="otherpage.php" class="link"><img src="test.jpg" alt="" width="100" height="100"/></a> </p> Additionally, I have some CSS sty ...

An easy way to divide an array into a table

I've obtained these arrays from a JSON file "Works": [ {"TypeOfWork": "scaffolding", "Status": "done"}, {"TypeOfWork": "painting", "Status": "on-going"} ] My go ...

Numerous objects come into view as you scroll

I found a code snippet online that animates items as they appear on scroll. However, the code only triggers animation for one item at a time. How can I modify the code to trigger the animation for all items? const observer = new IntersectionObserver(e ...

Utilize CSS with dynamically created elements

I am currently figuring out how to use my .each() function with a $(document).ready and a click event. Here's what I have so far: $(document).ready(function(){ $(".help-inline").each(function() { $(this).css('display', 'none&apos ...

The presence of a display block property within a div contained inside an li element results in extra whitespace

I am presenting the code below: <div class="settingsMenu" style="top: 135px; left: 149px; display: block;"> <ul> <li class="download" onclick="downTemplate('template1')">Download</li> <l ...

Having a problem with the glitch effect in Javascript - the text is oversized. Any tips on how to resize

I found some interesting code on the internet that creates a glitch text effect. However, when I implement it, the text appears too large for my webpage. I'm struggling to adjust the size. Here is the current display of the text: too big This is how ...

Modify the scrollbar's width, color, and corner radius to customize its appearance

Here is the table code where the styles are applied. By setting the tablecontainer height to 600px, we can make the table scrollable. However, I would like to customize the scrollbar with a different color, width, and corner radius. <TableContainer s ...

Highlighting rows using jQuery upon selecting checkboxes

I attempted to emphasize a row in a table using jQuery when the checkbox is checked. This is the jQuery code I used for this purpose: $(":checkbox").change(function() { $(this).closest("tr").toggleClass("highlight", this.checked); }); However, it see ...

Creating a Javascript countdown timer that does not involve displaying the

I stumbled upon this code on a website, but there's one tweak I'd like to make. Unfortunately, I can't seem to figure it out myself, so I'm reaching out for some help. What I want to achieve is removing the year from the date so that th ...