Skip to content
Tutorial Frontend

How to Create an Animated Orbit UI with HTML and CSS

Create a glowing animated orbit UI with HTML and CSS. Build a glassmorphism card, rotating neon lines and dots, nested orbits, and a responsive layout—without JavaScript.

Create a Modern Orbit Animation Using Pure CSS

Introduction

Learn how to build a futuristic animated orbit UI using only HTML and CSS. We will create a glassmorphism card with glowing rotating lines, orbiting dots, a smaller counter-rotating orbit, and a simple content panel. No JavaScript, frameworks, or external libraries are needed.

This tutorial follows the video step by step. We will first build the page structure, then add the gradients, glass effect, orbits, animations, and typography. At the end, you will find the complete index.html and style.css files. An optional section adds improvements for smaller screens and reduced-motion preferences; those additions go beyond the recorded steps.

What You Will Build

  • A dark gradient background with soft blue and purple highlights.
  • A semi-transparent 16:9 glassmorphism card with rounded corners.
  • A large orbit with a rotating neon line and glowing dot.
  • A smaller orbit that rotates in the opposite direction.
  • A heading, description, and visually styled Explore button.
  • Optional mobile and reduced-motion improvements.

The button in this exercise is a visual UI element, not a functioning navigation control. Adding a real action would be a separate lesson.

Before You Start

You need a code editor (such as VS Code) and a modern browser. Create a folder named orbit-animation-ui with these two files:

orbit-animation-ui/
├── index.html
└── style.css

Open both files in your editor. In each step, add the new HTML or append the indicated CSS rules to style.css. Do not paste multiple separate <style> blocks into the external stylesheet; they were only used to delimit snippets in the video script.

Step 1 — Create the Basic HTML Structure

Start by creating the overall page. The .scene is the outer container, and .card will become the glassmorphism panel. Inside the card, the .content element holds the title, description, and button. We will insert the orbit markup into this card in Step 4.

Create index.html:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Orbit Animation UI Tutorial</title>
    <link rel="stylesheet" href="style.css">
  </head>
<body>

  <div class="scene">
    <div class="card">

      <div class="content">
        <h1>Orbit UI</h1>
        <p>Simple HTML and CSS effect for modern websites.</p>
        <button>Explore</button>
      </div>

    </div>
  </div>

</body>
</html>

The stylesheet is loaded with <link rel="stylesheet" href="style.css">, so keep the file name exactly as shown. At this stage, the content will appear without its final design.

Step 2 — Add the Global CSS and Background

Begin style.css with color variables in :root, a universal box-sizing: border-box rule, and a full-viewport layout using CSS Grid.

:root{
  --bg0:#090b18;
  --bg1:#141c35;
  --text:#eef4ff;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  min-height:100vh;
  display:grid;
  place-items:center;
  overflow:hidden;
  font-family:system-ui,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 20% 20%, rgba(0,180,255,.15), transparent 35%),
    radial-gradient(circle at 80% 30%, rgba(170,80,255,.15), transparent 35%),
    linear-gradient(135deg,var(--bg0),var(--bg1));
}

Three background gradients combine to create a deep blue-purple atmosphere. place-items: center centers the card. The overflow: hidden declaration keeps the original desktop composition contained, but can cause clipping on small screens; we will address this in the optional enhancement.

Step 3 — Create the Glassmorphism Card

The scene is up to 1000 pixels wide and uses a 16:9 aspect ratio. The card fills it and uses transparency, a fine border, rounded corners, and background blur.

.scene{
  width:min(1000px,92vw);
  aspect-ratio:16/9;
}

.card{
  position:relative;
  width:100%;
  height:100%;
  overflow:hidden;
  border-radius:30px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  backdrop-filter:blur(12px);
}

background: rgba(255,255,255,.06) creates the translucent surface, while backdrop-filter: blur(12px) blurs the background behind the card. The overflow: hidden setting also clips decorative elements at the rounded edges.

Step 4 — Insert the Orbit HTML

Add the following markup inside .card, before .content in index.html:

      <div class="orbit">
        <div class="line">
          <div class="dot"></div>
        </div>
        <div class="small-orbit">
          <div class="line reverse">
            <div class="dot"></div>
          </div>
        </div>
      </div>

The outer .orbit contains one rotating .line and .dot. The nested .small-orbit holds a second line with the reverse class. Both dots are empty elements styled entirely with CSS. We will create their appearance in the next steps.

Step 5 — Style the Outer Orbit Ring

Position the orbit near the top-right corner of the card. Its pseudo-element produces a subtle circular ring.

.orbit{
  position:absolute;
  top:20px;
  right:20px;
  width:420px;
  height:420px;
}

.orbit::before{
  content:"";
  position:absolute;
  inset:22px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.08);
}

The outer orbit box is 420 × 420 pixels. Its ::before pseudo-element has a 22-pixel inset and a circular border, creating an inner circular guide without additional HTML.

Step 6 — Animate the Main Orbit Line

The main orbit arm starts at the center of .orbit. By setting transform-origin: left center, we rotate it around its left edge rather than around the middle of the line.

.line{
  position:absolute;
  left:50%;
  top:50%;
  width:190px;
  height:2px;
  background:linear-gradient(90deg,#61d7ff,#b06cff);
  transform-origin:left center;
  animation:spin 6s linear infinite;
  box-shadow:0 0 12px rgba(97,215,255,.8);
}

@keyframes spin{
  from{
    transform:rotate(0deg);
  }

  to{
    transform:rotate(360deg);
  }
}

animation: spin 6s linear infinite gives the line a continuous 360-degree rotation. The gradient colors and box-shadow make the thin line glow.

Step 7 — Attach the Glowing Dot

The dot belongs at the far end of the rotating line. As the line turns, the dot follows a circular path automatically.

.dot{
  position:absolute;
  right:-8px;
  top:-5px;
  width:12px;
  height:12px;
  border-radius:50%;
  background:#61d7ff;
  box-shadow:0 0 20px #61d7ff;
}

position: absolute and right: -8px place the 12-pixel dot near the line’s endpoint. border-radius: 50% creates the circle, and the blue box-shadow supplies the neon halo. This rule applies to both dots.

Step 8 — Create the Smaller Inner Orbit

The second orbit is centered within the larger one and has a faint border.

.small-orbit{
  position:absolute;
  left:50%;
  top:50%;
  width:300px;
  height:300px;
  margin-left:-150px;
  margin-top:-150px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.10);
}

Its width and height are 300 pixels. With left: 50% and top: 50%, plus negative 150-pixel margins, its center aligns with the outer orbit. This ring gives the animation a second depth layer.

Step 9 — Rotate the Second Line in Reverse

Use the .reverse modifier to make the smaller orbit’s line warm-colored and counter-rotating.

.line.reverse{
  position:absolute;
  left:50%;
  top:50%;
  width:150px;
  height:2px;
  background:linear-gradient(90deg,#ffb86c,#ff5fa2);
  transform-origin:left center;
  animation:spin-reverse 4.5s linear infinite;
  box-shadow:0 0 12px rgba(255,95,162,.8);
}

@keyframes spin-reverse{
  from{
    transform:rotate(360deg);
  }

  to{
    transform:rotate(0deg);
  }
}

The second arm measures 150 pixels and rotates in 4.5 seconds rather than 6 seconds. Its spin-reverse animation runs from 360 degrees to 0 degrees, so the two dots move in opposite directions.

Step 10 — Position and Style the Content

Finally, place the content over the decorative orbits. The title is large, the description is softer, and the button uses a bright gradient.

.content{
  position:absolute;
  left:40px;
  top:50%;
  transform:translateY(-50%);
  max-width:520px;
}
h1{
  margin:0;
  font-size:84px;
  line-height:.9;
}
p{
  color:rgba(255,255,255,.75);
  line-height:1.7;
  font-size:18px;
}
button{
  padding:16px 24px;
  font-size:16px;
  border:none;
  border-radius:14px;
  cursor:pointer;
  font-weight:700;
  background:linear-gradient(135deg,#61d7ff,#b06cff);
}

.content is positioned 40 pixels from the left edge and vertically centered with top: 50% plus translateY(-50%). The title uses an 84-pixel font size. The button has a pointer cursor and gradient styling, but no click behavior is implemented in this example.

Optional Enhancement — Mobile Layout and Reduced Motion

This section is an addition to the original video, not one of its recorded ten steps. The fixed 16:9 card and large title work best on desktop, but on narrow viewports they can leave too little vertical space for the content. The following CSS gives mobile screens a taller card, scales the orbits, adjusts the type, and permits vertical scrolling if needed.

It also stops the orbit animations when the visitor requests reduced motion in their operating system.

Append these rules to the end of style.css:

/* Optional improvement beyond the original video: mobile layout. */
@media (max-width: 700px){
  body{
    padding:16px 0;
    overflow-x:hidden;
    overflow-y:auto;
  }
  .scene{
    aspect-ratio:auto;
    height:480px;
  }
  .orbit{
    top:-44px;
    right:-52px;
    transform:scale(.67);
    transform-origin:top right;
  }
  .content{
    left:22px;
    right:22px;
    top:auto;
    bottom:28px;
    max-width:none;
    transform:none;
  }
  .content h1{
    font-size:clamp(2.8rem, 12vw, 4.25rem);
    letter-spacing:-.04em;
  }
  .content p{
    font-size:1rem;
  }
}

/* Optional improvement beyond the original video: reduced motion. */
@media (prefers-reduced-motion:reduce){
  .line,
  .line.reverse{
    animation:none;
  }
}

The mobile breakpoint is an example, not a requirement to match particular devices. The source video does not include these rules; the final reference stylesheet below does include them to make the example more usable across screen sizes.

Complete Project Files

The snippets above explain the build in the same order as the video. Here are the complete files so you can compare your project against a finished reference. Do not paste the final file examples underneath the partial snippets a second time; replace or consolidate your file contents instead.

Complete index.html

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Orbit Animation UI Tutorial</title>
    <link rel="stylesheet" href="style.css">
  </head>
<body>

  <div class="scene">
    <div class="card">

      <div class="orbit">
        <div class="line">
          <div class="dot"></div>
        </div>
        <div class="small-orbit">
          <div class="line reverse">
            <div class="dot"></div>
          </div>
        </div>
      </div>

      <div class="content">
        <h1>Orbit UI</h1>
        <p>Simple HTML and CSS effect for modern websites.</p>
        <button>Explore</button>
      </div>

    </div>
  </div>

</body>
</html>

Complete style.css

The stylesheet below combines the eight original CSS sections and the optional responsive/reduced-motion enhancement. It does not require JavaScript.

:root{
  --bg0:#090b18;
  --bg1:#141c35;
  --text:#eef4ff;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  min-height:100vh;
  display:grid;
  place-items:center;
  overflow:hidden;
  font-family:system-ui,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 20% 20%, rgba(0,180,255,.15), transparent 35%),
    radial-gradient(circle at 80% 30%, rgba(170,80,255,.15), transparent 35%),
    linear-gradient(135deg,var(--bg0),var(--bg1));
}

.scene{
  width:min(1000px,92vw);
  aspect-ratio:16/9;
}

.card{
  position:relative;
  width:100%;
  height:100%;
  overflow:hidden;
  border-radius:30px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  backdrop-filter:blur(12px);
}

.orbit{
  position:absolute;
  top:20px;
  right:20px;
  width:420px;
  height:420px;
}

.orbit::before{
  content:"";
  position:absolute;
  inset:22px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.08);
}

.line{
  position:absolute;
  left:50%;
  top:50%;
  width:190px;
  height:2px;
  background:linear-gradient(90deg,#61d7ff,#b06cff);
  transform-origin:left center;
  animation:spin 6s linear infinite;
  box-shadow:0 0 12px rgba(97,215,255,.8);
}

@keyframes spin{
  from{
    transform:rotate(0deg);
  }

  to{
    transform:rotate(360deg);
  }
}

.dot{
  position:absolute;
  right:-8px;
  top:-5px;
  width:12px;
  height:12px;
  border-radius:50%;
  background:#61d7ff;
  box-shadow:0 0 20px #61d7ff;
}

.small-orbit{
  position:absolute;
  left:50%;
  top:50%;
  width:300px;
  height:300px;
  margin-left:-150px;
  margin-top:-150px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.10);
}

.line.reverse{
  position:absolute;
  left:50%;
  top:50%;
  width:150px;
  height:2px;
  background:linear-gradient(90deg,#ffb86c,#ff5fa2);
  transform-origin:left center;
  animation:spin-reverse 4.5s linear infinite;
  box-shadow:0 0 12px rgba(255,95,162,.8);
}

@keyframes spin-reverse{
  from{
    transform:rotate(360deg);
  }

  to{
    transform:rotate(0deg);
  }
}

.content{
  position:absolute;
  left:40px;
  top:50%;
  transform:translateY(-50%);
  max-width:520px;
}
h1{
  margin:0;
  font-size:84px;
  line-height:.9;
}
p{
  color:rgba(255,255,255,.75);
  line-height:1.7;
  font-size:18px;
}
button{
  padding:16px 24px;
  font-size:16px;
  border:none;
  border-radius:14px;
  cursor:pointer;
  font-weight:700;
  background:linear-gradient(135deg,#61d7ff,#b06cff);
}

/* Optional improvement beyond the original video: mobile layout. */
@media (max-width: 700px){
  body{
    padding:16px 0;
    overflow-x:hidden;
    overflow-y:auto;
  }
  .scene{
    aspect-ratio:auto;
    height:480px;
  }
  .orbit{
    top:-44px;
    right:-52px;
    transform:scale(.67);
    transform-origin:top right;
  }
  .content{
    left:22px;
    right:22px;
    top:auto;
    bottom:28px;
    max-width:none;
    transform:none;
  }
  .content h1{
    font-size:clamp(2.8rem, 12vw, 4.25rem);
    letter-spacing:-.04em;
  }
  .content p{
    font-size:1rem;
  }
}

/* Optional improvement beyond the original video: reduced motion. */
@media (prefers-reduced-motion:reduce){
  .line,
  .line.reverse{
    animation:none;
  }
}

Test the Finished Effect

  1. Open index.html in a browser and confirm that the dark gradient background fills the page.
  2. Confirm that the card has a translucent glass-like appearance and its rounded corners clip the decorative elements.
  3. Watch the large blue-purple arm and glowing dot rotate in one direction.
  4. Watch the smaller orange-pink arm rotate in the opposite direction at a different speed.
  5. Confirm that the Orbit UI heading, description, and gradient button remain visible above the decorative graphics.
  6. Resize your browser to desktop and narrow widths (for example 320px, 390px, 768px, and 1200px). The optional responsive rules should keep the card and text usable without document-level horizontal scrolling.
  7. Enable your operating system’s Reduce Motion setting and check that the spinning animations stop.

The effect is pure CSS. No mouse events, JavaScript, data requests, checkout, or working button action are part of this project.

Troubleshooting

The page has no styling

Confirm the file is named style.css (singular) and is in the same directory as index.html. Check the <link rel="stylesheet" href="style.css"> reference.

I can see the card but no orbit

Check that the Step 4 .orbit markup was added inside .card, and that the .line, .dot, .small-orbit, and .reverse class names match their CSS selectors exactly.

The dots are visible but do not move

Verify that both @keyframes spin and @keyframes spin-reverse exist and that the lines have the corresponding animation declarations. Also check whether your device has Reduce Motion enabled; the optional accessibility rule intentionally disables those animations.

The heading or button is clipped on mobile

Apply the optional mobile CSS. In the original video version, the card keeps a 16:9 aspect ratio even on phones, while the title stays 84 pixels tall. Those rules can cause content to be clipped on smaller viewports.

The Explore button does nothing

That is expected. The example focuses on visual UI and CSS animation. The button is styled, but it has no JavaScript handler or navigation destination.

What You Learned

You combined a responsive page wrapper, glassmorphism, pseudo-elements, CSS gradients, transform-origin, keyframe animations, and nested orbit elements into one coherent UI component. This is a useful pattern for decorative hero sections, concept designs, and animation practice.

The key idea is that CSS alone can create sophisticated motion when simple shapes, transforms, timing, and layered colors work together. You can customize the colors, ring sizes, rotation speeds, and text to turn this example into your own design.