Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <main class="solar-system">
  <article class="solar-system__sun"></article>
  <section class="solar-system__mercury-trajectory">
    <article class="solar-system__mercury-trajectory__mercury"></article>
  </section>
  <section class="solar-system__venus-trajectory">
    <article class="solar-system__venus-trajectory__venus"></article>
  </section>
  <section class="solar-system__earth-trajectory">
    <article class="solar-system__earth-trajectory__earth"></article>
  </section>
  <section class="solar-system__mars-trajectory">
    <article class="solar-system__mars-trajectory__mars"></article>
  </section>
  <!-- [♃,♄,⛢,♆] are too far for my little starship. 🚀🪐-->
</main>
<footer>
  <a target="_blank" rel="noopener noreferrer" href="https://linktr.ee/delvignefred" aria-label="All my social media links">
    <svg id="logo" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 400 400" aria-hidden="true">
      <circle cx="200" cy="200" r="196.6"></circle>
      <path d="M302.9,84.4H170.5h-8.1c-23.3,0-34.9,9.1-45,29.4l-26.2,52.3c-6,12.2-8.9,20.8-8.9,34.5    c0,11.9,3.3,22,8.6,32.8l27.1,54.3c10.4,21.2,23.9,28,47.1,28h20.3c0,0,0,0,0,0c0,0,0,0,0,0h29.2c7.8,0,14.9-3.5,14.9-14.2    c0-10.7-7.2-14.2-14.9-14.2h-15.3v-96.6h74.3c7.8,0,14.9-4.6,14.9-15.4c0-10.7-7.2-15.4-14.9-15.4h-74.3v-45.2h103.6    c7.8,0,14.9-4.3,14.9-15.1C317.8,88.8,310.6,84.4,302.9,84.4z M170.3,287.1h-5.5c-12.5,0-15.5-2.2-20.9-13.2l-26.2-53.4    c-3.3-6.9-5.7-12.1-5.7-19.6c0-10.1,3.3-15.9,7.5-24.5l24.8-49.8c6.3-12.8,8.9-12,22.7-12h3.4V287.1z">
      </path>
    </svg>
  </a>
</footer>
              
            
!

CSS

              
                :root {
  /** color system **/
  --system-color-dark: oklch(0% 0 0);
  --system-color-light: oklch(100% 0 0);
  --system-color-logo: oklch(60.07% 0.241 28.73 / 80%);
  --system-color-red-100: oklch(60.07% 0.241 28.73 / 25%);
  --system-color-red-200: oklch(60.07% 0.241 28.73 / 50%);
  --system-color-red-300: oklch(60.07% 0.241 28.73 / 100%);

  /** color themes **/
  --system-color-theme-paths: var(--system-color-red-100)
    var(--system-color-red-300);
  --system-color-theme-planets: var(--system-color-red-200)
    var(--system-color-red-200) var(--system-color-red-200)
    var(--system-color-red-300);

  /** planet's radius **/
  /* ♂ Mars real radius ≈ 3389.5km. */
  --planet-radius-mars: 33.895px;
  /* 🜨 Earth real radius ≈ 6371km. */
  --planet-radius-earth: 63.71px;
  /* ♀ Venus real radius ≈ 6051.8km. */
  --planet-radius-venus: 60.518px;
  /* ☿ Mercury real radius ≈ 2439.7km. */
  --planet-radius-mercury: 24.397px;
  /* ☉ Sun real radius ≈ 696340km (40 times smaller compared to the planet's dimensions values). */
  --star-radius-sun: 174.085px;

  /** planet's trajectories **/
  --planet-trajectory-mars: 446.085px;
  --planet-trajectory-earth: 332.085px;
  --planet-trajectory-venus: 257.085px;
  --planet-trajectory-mercury: 203.085px;

  /** units **/
  --system-margin-mars: 292px;
  --system-margin-earth: 35px;
  --system-margin-venus: 15px;
  --system-margin-mercury: 38px;
  --system-border-width: min(2px, 0.4dvmin);
}

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

html {
  font-size: 16px;
}

body {
  overflow: hidden;

  inline-size: 100dvw;
  block-size: 100dvh;

  background-color: var(--system-color-dark);

  /* ☛ ⚠ The distances between the planets and the Sun are not respected because of the diameter of it.
    Also note that for aesthetic reasons, the planet's trajectories are not elliptical and are not oriented as they should be. */

  & .solar-system {
    display: flex;
    justify-content: center;
    align-items: center;

    inline-size: 100%;
    block-size: 100%;

    transform: skewX(-45deg);
    -webkit-transform: skewX(-45deg);

    & .solar-system__sun {
      z-index: 100;

      /* ☛ ⚠ Size of the Sun is not respected here. */
      aspect-ratio: 1;
      inline-size: var(--star-radius-sun);
      border-radius: 50%;

      background-color: var(--system-color-red-300);
      background: linear-gradient(
        135deg,
        var(--system-color-red-300) 20%,
        transparent
      );

      filter: drop-shadow(0px 0px 2px var(--system-color-red-300)) blur(1px);
      -webkit-filter: drop-shadow(0px 0px 2px var(--system-color-red-300))
        blur(1px);

      transform: skewX(45deg);
      -webkit-transform: skewX(45deg);
    }

    & article:not(.solar-system__sun) {
      display: flex;
      justify-content: center;
      align-items: center;

      position: absolute;
      z-index: 99;

      aspect-ratio: 1;
      border-radius: 50%;

      background: transparent;

      border-width: var(--system-border-planets-width);
      border-style: solid;
      border-color: var(--system-color-theme-planets);

      &::after {
        content: "";
        aspect-ratio: 1;
        inline-size: 40%;
        border-radius: 50%;

        background: var(--system-color-red-300);

        -webkit-filter: drop-shadow(0px 0px 4.8px var(--system-color-red-200))
          blur(0.5px);
        filter: drop-shadow(0px 0px 4.8px var(--system-color-red-200))
          blur(0.5px);
      }
    }

    & section {
      position: absolute;
      z-index: 98;
      aspect-ratio: 1;

      border-radius: 50%;

      border-width: var(--system-border-width);
      border-style: solid;
      border-color: var(--system-color-theme-paths);
    }

    & .solar-system__mercury-trajectory {
      inline-size: var(--planet-trajectory-mercury);

      /* ☿ Mercury revolution duration ≈ 87.969 days. */
      -webkit-animation: revolution 43.9845s linear infinite;
      animation: revolution 43.9845s linear infinite;

      & .solar-system__mercury-trajectory__mercury {
        inline-size: var(--planet-radius-mercury);
        top: var(--system-margin-mercury);

        /* ☿ Mercury rotation period ≈ 58.645 days. */
        -webkit-animation: revolution 29.3225s linear infinite;
        animation: revolution 29.3225s linear infinite;
      }
    }

    & .solar-system__venus-trajectory {
      inline-size: var(--planet-trajectory-venus);

      /* ♀ Venus revolution duration ≈ 224.667 days. */
      -webkit-animation: revolution 112.3335s linear infinite;
      animation: revolution 112.3335s linear infinite;

      & .solar-system__venus-trajectory__venus {
        inline-size: var(--planet-radius-venus);
        top: var(--system-margin-venus);

        /* ♀ Venus rotation period ≈ 243.023 days. */
        -webkit-animation: revolution 121.513s linear infinite;
        animation: revolution 121.513s linear infinite;
      }
    }

    & .solar-system__earth-trajectory {
      inline-size: var(--planet-trajectory-earth);

      /* 🜨 Earth revolution duration ≈ 365.2422 days. */
      -webkit-animation: revolution 182.6211s linear infinite;
      animation: revolution 182.6211s linear infinite;

      & .solar-system__earth-trajectory__earth {
        inline-size: var(--planet-radius-earth);
        top: var(--system-margin-earth);

        /* ✑ animation-duration: .5s ≈ 24 hours on Earth. */
        -webkit-animation: revolution 0.4874s linear infinite;
        animation: revolution 0.4874s linear infinite;

        &::after {
          -webkit-animation: blink 2s linear infinite;
          animation: blink 2s linear infinite;
        }
      }
    }

    & .solar-system__mars-trajectory {
      inline-size: var(--planet-trajectory-mars);

      /* ♂ Mars revolution duration ≈ 686.885 days. */
      -webkit-animation: revolution 343.4425s linear infinite;
      animation: revolution 343.4425s linear infinite;

      & .solar-system__mars-trajectory__mars {
        inline-size: var(--planet-radius-mars);
        top: var(--system-margin-mars);

        /* ✑ animation-duration: .5s ≈ 24 hours on Earth. */
        -webkit-animation: revolution 0.5128s linear infinite;
        animation: revolution 0.5128s linear infinite;
      }
    }
  }
  & #logo {
    inline-size: 8dvmin;
    aspect-ratio: 1;
    position: fixed;
    inset: auto 1.6dvmin 1.6dvmin auto;

    opacity: 0.3;
    -webkit-filter: saturate(60%);
    filter: saturate(60%);

    transition: opacity 0.7s linear, filter 0.7s linear;

    & circle {
      -webkit-fill: var(--system-color-logo);
      fill: var(--system-color-logo);
    }

    & path {
      -webkit-fill: var(--system-color-dark);
      fill: var(--system-color-dark);
    }

    &:hover {
      opacity: 1;
      -webkit-filter: saturate(100%);
      filter: saturate(100%);
    }
  }
}

/*
▀▄▀▄▀▄▀▄▀▄▀▄ ANIMATIONS ▀▄▀▄▀▄▀▄▀▄▀▄
*/

@keyframes revolution {
  to {
    transform: rotateZ(1turn);
  }
}

@keyframes blink {
  to {
    background-color: var(--system-color-dark);

    filter: drop-shadow(0 0 0 var(--system-color-red-200)) blur(0);
  }
}

/*** ◰ media queries ***/
/** smartphone **/
@media screen and (width < 768px) {
  body {
    & .solar-system {
      & .solar-system__sun {
        inline-size: calc(var(--star-radius-sun) / 2);
      }
      & .solar-system__mercury-trajectory {
        inline-size: calc(var(--planet-trajectory-mercury) / 2);

        & .solar-system__mercury-trajectory__mercury {
          inline-size: calc(var(--planet-radius-mercury) / 2);

          top: calc(var(--system-margin-mercury) - 20px);
        }
      }

      & .solar-system__venus-trajectory {
        inline-size: calc(var(--planet-trajectory-venus) / 2);

        & .solar-system__venus-trajectory__venus {
          inline-size: calc(var(--planet-radius-venus) / 2);

          top: calc(var(--system-margin-venus) - 9px);
        }
      }

      & .solar-system__earth-trajectory {
        inline-size: calc(var(--planet-trajectory-earth) / 2);

        & .solar-system__earth-trajectory__earth {
          inline-size: calc(var(--planet-radius-earth) / 2);

          top: calc(var(--system-margin-earth) - 19px);
        }
      }

      & .solar-system__mars-trajectory {
        inline-size: calc(var(--planet-trajectory-mars) / 2);

        & .solar-system__mars-trajectory__mars {
          inline-size: calc(var(--planet-radius-mars) / 2);

          top: calc(var(--system-margin-mars) - 234px);
        }
      }
    }
  }
}

/** 4K and 8K Ultra HD **/
/*
@media screen and (width > 1920px) {
    & .solar-system__sun {
        inline-size: calc(var(--star-radius-sun) * 2);
    }
}

@media screen and (width > 3840px) {
    & .solar-system__sun {
        inline-size: calc(var(--star-radius-sun) * 4);
    }
}*/

              
            
!

JS

              
                
              
            
!
999px

Console