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

Tips for making your inner content as wide as possible

I'm currently working on developing collapsible tables, where an outer and inner table are displayed for every row that is clicked. This is the code I have implemented: HTML: <table class="table outerTbl mb-0"> <thead> <t ...

The display: flex property is not being properly implemented in Tailwind CSS for the sm:flex

I have a div with the following styles <div class="hidden sm:visible sm:flex"> .... </div> The sm:visible style is applied like this @media (min-width: 640px) .sm\:visible { visibility: visible; } However, the property disp ...

Is the textarea functioning properly with the inclusion of mysterious character variables?

As per the documentation When using an unknown named character reference like &this, it results in an ambiguous ampersand error. This situation is confusing <textarea> &this </textarea> What am I misunderstanding here? Any re ...

Persistent hover effect for collapsible accordion panels when closing them

My simple accordion features a functionality where a class of .open is added to the title + content group when you open a panel for styling purposes. Everything works smoothly, but I've noticed on my phone that after clicking to close a panel, the hov ...

The disappearance of the checkbox is not occurring when the text three is moved before the input tag

When I move text three before the input tag, the checkbox does not disappear when clicked for the third time. However, if I keep text three after the input tag, it works fine. Do you have any suggestions on how to fix this issue? I have included my code be ...

CssLint detected an unfamiliar property: "fill"

Currently, I am updating the color of an SVG path using CSS: .compute .svg path { fill: #fff; } The functionality is working properly, however, during a CSSLint check, I received this warning: Unknown property: "fill" I am unsure if this is an erro ...

Assigning background colors based on the data stored in a specific field of a MySQL database

I have successfully implemented a Ticketing System using PHP and MySQL database. The view tickets page displays each ticket from the database along with its priority level, which can be Low, Normal or High. Currently, the priority value pulled from the d ...

Pedaling back and forth along a sequence

Is there a way to implement forward and backward buttons for a clickable list without using arrays, as the list will be expanding over time? I have already achieved changing color of the listed items to red, but need a solution to navigate through the list ...

Ensuring the correct width for a .png image in an email newsletter for Outlook 2013

After creating an email newsletter that works perfectly on all email clients except Outlook 2013, I realized that the image I included is not adhering to the table width specified. Instead, it is defaulting to its own width of 658px. View image here Below ...

What is the reason behind getElementsByClassName not functioning while getElementById is working perfectly?

The initial code snippet is not functioning correctly DN.onkeyup = DN.onkeypress = function(){ var div = document.getElementById("DN").value document.document.getElementsByClassName("options-parameters-input").style.fontSize = div; } #one{ heigh ...

Getting the checkbox count value in a treeview upon successful completion of an AJAX request

After successful JSON Ajax response, a treeview structure with checkboxes is displayed. I need to capture the number of checkboxes checked when the save button is clicked. @model MedeilMVC_CLOUD.Models.UserView <script type="text/javascript"> ...

What is causing my divs not to center with justify-content?

I've been working on centering two divs inside a parent div horizontally. The parent div is set to flex-direction: column so that the child divs stack one below the other, but I want them centered in the middle of the page. Although justify-content: ...

Issue with jQuery .hover() not functioning as expected

The issue I'm encountering is just as described in the title. The code functions correctly on all divs except for one! $(".complete-wrapper-1").hide(); var panelHH = $(".file-select-wrapper").innerHeight; $(".files-button").hover(function(){ $(" ...

Error encountered while trying to upload a file using PHP on a hosting platform

Hey everyone, I'm feeling really frustrated right now because I'm facing a file upload error in my PHP code. The issue is that the file is not getting uploaded to my folder and no error messages are being displayed. I've been working on cr ...

Position a grid item in the center

Can someone help me with centering my container's item? I am struggling to align the third item to the center using display: grid. Previously, I attempted to use flexbox but found it to be less effective for a responsive layout. .projetos { f ...

Ways to break up the loop for showing 2 items on each slide and 1 item every 3rd slide

I have a database with approximately 19 images that I want to display in slides. The goal is to have 9 slides with 2 images each and the 10th slide with just 1 image. Additionally, every fifth item should be displayed individually. For example: Slide 1 - ...

Implement the maskmoney library in your input fields

In the form below, I am automatically adding inputs using a JavaScript function like this: $('.Preco1').maskMoney({ decimal: '.', thousands: ' ', precision: 2 }); $('.Preco1').focus(); $('#sub').maskMon ...

Access the website by logging in with idhttp

I'm attempting to log in to a website using Delphi / Indy. Currently, I only have a button (used to send a password / username) that calls this procedure. procedure TForm5.Login(name: string; Pass: string); var UserID :string; Password :string; res : ...

Having issues with the CSS block in my Jekyll dropdown navbar

I have been exploring resources from both w3schools and another website to create a navigation bar in Jekyll using frontmatter. However, I am running into issues with the block property in CSS. Most of the navbar is functioning properly, except for the dro ...

Steps for adding a navbar that slides horizontally and overlaps other links on a webpage

I am attempting to design a sliding navigation menu using JQuery. The concept involves having multiple main sections, each with several subsections. When a user hovers over a section, the subsections will expand horizontally. If another section is current ...