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-container
  .tab-container
    .tab-header
      .tab-shine
      each _, i in Array(3).fill(0)
        .tab(class=i == 1 ? 'active' : '') Tab #{i+1}

              
            
!

CSS

              
                :root {
  --dark: #000;
  --primary: #150050;
  --secondary: #3f0071;
}

$dark: #000;
$primary: #150050;
$secondary: #3f0071;
$tertiary: #610094;

$dark100: #00000000;
$primary100: #15005000;
$secondary100: #3f007100;
$tertiary100: #61009400;

$dark200: #000000aa;
$primary200: #150050aa;
$secondary200: #3f0071aa;
$tertiary200: #610094aa;

$light: #dadada;

body {
  overflow: hidden;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter Tight";
  color: $light;
}

.main-container {
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: radial-gradient(circle at 5% 45%, $dark 20%, $primary100 60%),
    radial-gradient(circle at 50% 60%, $dark 40%, $secondary100 80%),
    radial-gradient(circle at 25% 40%, $tertiary 42%, $dark100 60%),
    radial-gradient(circle at 35% 95%, $dark100 30%, $primary 60%),
    radial-gradient(circle at 100% 40%, $tertiary 38%, $dark100 70%),
    radial-gradient(circle at 10% 70%, $tertiary 38%, $dark100 70%);
}

.tab-container {
  --shine-start: 0%;
  --shine-mid: 50%;
  --shine-end: 100%;

  width: 500px;
  max-width: calc(100vw - 40px);
  // height: 400px;
  overflow: hidden;
  border-radius: 5px;
  background: linear-gradient(to bottom, #101010, $dark100);
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 600px 40px $secondary200;
}

.tab-header {
  display: flex;
  position: relative;
  overflow: hidden;
  justify-content: center;
  border-top: 1px solid;
  border-width: 2px;
  border-image-source: linear-gradient(
    to right,
    $secondary100 var(--shine-start),
    $secondary var(--shine-mid),
    $secondary100 var(--shine-end)
  );
  border-image-slice: 1;
  border-bottom: 1px solid $secondary200;
  transition: 0.25s;
  &:before {
    content: "";
    position: absolute;
    width: 100%;
    height: 40%;
    background: #ffffff05;
  }
  .tab-shine {
    position: absolute;
    left: 50%;
    top: -60%;
    transform: translateX(-50%);
    height: 120px;
    width: 280px;
    background: radial-gradient($secondary200, $secondary100 60%);
    transition: 0.25s;
  }

  .tab {
    position: relative;
    z-index: 1;
    padding: 26px 40px;
    cursor: pointer;
    opacity: 0.4;
    transition: 0.25s;

    &:hover {
      opacity: 0.8;
    }

    &.active {
      opacity: 1;
    }
  }
}

              
            
!

JS

              
                const select = (selector: string) => document.querySelector(selector);
const selectAll = (selector: string) => document.querySelectorAll(selector);

const tabs = selectAll(".tab");
const shine = select(".tab-shine");
const headerContainer = select(".tab-header");

const setActive = (el: HTMLElement) => {
  const tabCenter =
    (el.offsetLeft + el.offsetWidth / 2) / headerContainer.offsetWidth;
  shine.style.left = `${tabCenter * 100}%`;

  headerContainer.style.setProperty(
    "--shine-start",
    `${(tabCenter - 0.5) * 100}%`
  );
  headerContainer.style.setProperty("--shine-mid", `${tabCenter * 100}%`);
  headerContainer.style.setProperty(
    "--shine-end",
    `${(tabCenter + 0.5) * 100}%`
  );

  const currentActive = select(".active");
  currentActive.classList.remove("active");
  el.classList.add("active");
};

tabs.forEach((tab) => {
  tab.addEventListener("click", (e) => {
    setActive(e.target);
  });
});

              
            
!
999px

Console