Skip to content

Instantly share code, notes, and snippets.

@Nesa344
Last active February 16, 2021 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nesa344/6e04559db3e3bee6b098700fffdb17b2 to your computer and use it in GitHub Desktop.
Save Nesa344/6e04559db3e3bee6b098700fffdb17b2 to your computer and use it in GitHub Desktop.
The React.js logo made with pure CSS code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React Logo</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="react">
<div class="ring"></div>
<div class="ring"></div>
<div class="ring"></div>
<div class="center"></div>
</div>
</body>
</html>
/*======== STEP 1 ========*/
/* Add Body Reset Styles */
body {
margin: 0;
background: #1f1f1f;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
/*======== STEP 2 ========*/
/* Main Container Styles */
.react {
width: 15em;
height: 15em;
position: relative;
animation: rotate 10s linear infinite;
}
/*======== STEP 3 ========*/
/* Add Common Ring And Centered Dot Styles */
.react .ring, .react .center {
position: absolute;
top: 50%;
left: 50%;
border-radius: 50%;
transform: translate(-50%, -50%);
}
/*======== STEP 4 ========*/
/* Style The Rings */
.react .ring {
border: 12px #51d4f4 solid;
width: 5em;
height: 100%;
transform: translate(-50%, -50%) rotate(90deg);
}
.react .ring:nth-child(2) {
transform: translate(-50%, -50%) rotate(30deg);
}
.react .ring:nth-child(3) {
transform: translate(-50%, -50%) rotate(-30deg);
}
/*======== STEP 5 ========*/
/* Style The Centered Dot */
.react .center {
background: #51d4f4;
width: 3em;
height: 3em;
}
/*======== STEP 6 ========*/
/* Add The Rotate Animation */
@keyframes rotate {
to {transform: rotate(180deg);}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment