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

              
                    <div class="accordion">
      <div class="tab">
        <div class="tab-name">
          UI Secrets
          <svg
            class="chevron-icon"
            width="26"
            height="13"
            viewBox="0 0 26 13"
            fill="none"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              fill-rule="evenodd"
              clip-rule="evenodd"
              d="M1.06414 1.06414C1.35704 0.771251 1.83191 0.771251 2.1248 1.06414L11.2676 10.2069C11.6724 10.6117 11.9445 10.883 12.1708 11.0751C12.3904 11.2615 12.5171 11.329 12.6137 11.3604C12.8648 11.442 13.1352 11.442 13.3863 11.3604C13.4829 11.329 13.6096 11.2615 13.8292 11.0751C14.0556 10.883 14.3276 10.6117 14.7324 10.2069L23.8752 1.06414C24.1681 0.771251 24.643 0.771251 24.9359 1.06414C25.2287 1.35704 25.2287 1.83191 24.9359 2.1248L15.7931 11.2676L15.7715 11.2892C15.3938 11.6668 15.0786 11.9821 14.8 12.2186C14.5094 12.4653 14.2098 12.67 13.8498 12.787C13.2975 12.9664 12.7025 12.9664 12.1502 12.787C11.7902 12.67 11.4906 12.4653 11.2 12.2186C10.9214 11.9821 10.6061 11.6668 10.2285 11.2891L10.2069 11.2676L1.06414 2.1248C0.771251 1.83191 0.771251 1.35704 1.06414 1.06414Z"
            />
          </svg>
        </div>
        <div class="tab-content">
          Lorem ipsum, dolor sit amet consectetur adipisicing elit. Laudantium
          dolorem iure similique modi sequi asperiores.
        </div>
      </div>
      <div class="tab">
        <div class="tab-name">
          HTML Secrets
          <svg
            class="chevron-icon"
            width="26"
            height="13"
            viewBox="0 0 26 13"
            fill="none"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              fill-rule="evenodd"
              clip-rule="evenodd"
              d="M1.06414 1.06414C1.35704 0.771251 1.83191 0.771251 2.1248 1.06414L11.2676 10.2069C11.6724 10.6117 11.9445 10.883 12.1708 11.0751C12.3904 11.2615 12.5171 11.329 12.6137 11.3604C12.8648 11.442 13.1352 11.442 13.3863 11.3604C13.4829 11.329 13.6096 11.2615 13.8292 11.0751C14.0556 10.883 14.3276 10.6117 14.7324 10.2069L23.8752 1.06414C24.1681 0.771251 24.643 0.771251 24.9359 1.06414C25.2287 1.35704 25.2287 1.83191 24.9359 2.1248L15.7931 11.2676L15.7715 11.2892C15.3938 11.6668 15.0786 11.9821 14.8 12.2186C14.5094 12.4653 14.2098 12.67 13.8498 12.787C13.2975 12.9664 12.7025 12.9664 12.1502 12.787C11.7902 12.67 11.4906 12.4653 11.2 12.2186C10.9214 11.9821 10.6061 11.6668 10.2285 11.2891L10.2069 11.2676L1.06414 2.1248C0.771251 1.83191 0.771251 1.35704 1.06414 1.06414Z"
            />
          </svg>
        </div>
        <div class="tab-content">
          Lorem ipsum dolor, sit amet consectetur adipisicing elit. Libero saepe
          cupiditate porro repellat magnam qui eos quos sunt, ratione dicta.
          Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat amet
          quidem alias.
        </div>
      </div>
      <div class="tab">
        <div class="tab-name">
          CSS Secrets
          <svg
            class="chevron-icon"
            width="26"
            height="13"
            viewBox="0 0 26 13"
            fill="none"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              fill-rule="evenodd"
              clip-rule="evenodd"
              d="M1.06414 1.06414C1.35704 0.771251 1.83191 0.771251 2.1248 1.06414L11.2676 10.2069C11.6724 10.6117 11.9445 10.883 12.1708 11.0751C12.3904 11.2615 12.5171 11.329 12.6137 11.3604C12.8648 11.442 13.1352 11.442 13.3863 11.3604C13.4829 11.329 13.6096 11.2615 13.8292 11.0751C14.0556 10.883 14.3276 10.6117 14.7324 10.2069L23.8752 1.06414C24.1681 0.771251 24.643 0.771251 24.9359 1.06414C25.2287 1.35704 25.2287 1.83191 24.9359 2.1248L15.7931 11.2676L15.7715 11.2892C15.3938 11.6668 15.0786 11.9821 14.8 12.2186C14.5094 12.4653 14.2098 12.67 13.8498 12.787C13.2975 12.9664 12.7025 12.9664 12.1502 12.787C11.7902 12.67 11.4906 12.4653 11.2 12.2186C10.9214 11.9821 10.6061 11.6668 10.2285 11.2891L10.2069 11.2676L1.06414 2.1248C0.771251 1.83191 0.771251 1.35704 1.06414 1.06414Z"
            />
          </svg>
        </div>
        <div class="tab-content">
          Lorem, ipsum dolor sit amet consectetur adipisicing elit.
        </div>
      </div>
      <div class="tab">
        <div class="tab-name">
          JS Secrets
          <svg
            class="chevron-icon"
            width="26"
            height="13"
            viewBox="0 0 26 13"
            fill="none"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              fill-rule="evenodd"
              clip-rule="evenodd"
              d="M1.06414 1.06414C1.35704 0.771251 1.83191 0.771251 2.1248 1.06414L11.2676 10.2069C11.6724 10.6117 11.9445 10.883 12.1708 11.0751C12.3904 11.2615 12.5171 11.329 12.6137 11.3604C12.8648 11.442 13.1352 11.442 13.3863 11.3604C13.4829 11.329 13.6096 11.2615 13.8292 11.0751C14.0556 10.883 14.3276 10.6117 14.7324 10.2069L23.8752 1.06414C24.1681 0.771251 24.643 0.771251 24.9359 1.06414C25.2287 1.35704 25.2287 1.83191 24.9359 2.1248L15.7931 11.2676L15.7715 11.2892C15.3938 11.6668 15.0786 11.9821 14.8 12.2186C14.5094 12.4653 14.2098 12.67 13.8498 12.787C13.2975 12.9664 12.7025 12.9664 12.1502 12.787C11.7902 12.67 11.4906 12.4653 11.2 12.2186C10.9214 11.9821 10.6061 11.6668 10.2285 11.2891L10.2069 11.2676L1.06414 2.1248C0.771251 1.83191 0.771251 1.35704 1.06414 1.06414Z"
            />
          </svg>
        </div>
        <div class="tab-content">
          Lorem ipsum dolor sit amet consectetur adipisicing elit. Recusandae
          pariatur cumque similique nemo ipsum tempora dolorem id ipsa! Cumque,
          sint?
        </div>
      </div>
    </div>

    <!-- made in jssecrets.com -->
    <a class="jssecrets" href="https://jssecrets.com/" target="_blank"
      >jssecrets.com</a
    >
    <!-- made in jssecrets.com -->
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Urbanist:wght@400;700&display=swap");
*,
::before,
::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Urbanist", sans-serif;
}

body {
  height: 100vh;
  background: radial-gradient(circle, rgb(255, 255, 255) 70%, rgb(243, 243, 243) 100%);
  position: relative;
}

.accordion {
  width: 300px;
  padding: 24px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 25px rgba(124, 130, 141, 0.2);
  position: relative;
  transform-style: preserve-3d;
  margin-left: auto;
  margin-right: auto;
  margin-top: 120px;
}
@media (max-width: 400px) {
  .accordion {
    width: 240px;
  }
}
.accordion::after {
  content: "";
  width: 100%;
  height: 100%;
  background: linear-gradient(white, white) padding-box, linear-gradient(135deg, rgb(123, 104, 238) 0%, rgb(235, 61, 174) 33%, rgb(247, 206, 81) 66%, rgb(91, 197, 250) 100%) border-box;
  border: 2px dashed transparent;
  border-radius: 8px;
  position: absolute;
  top: 0px;
  left: 0px;
  transform: translateZ(-10px) rotate(5deg);
}
.accordion .tab {
  cursor: pointer;
}
.accordion .tab:not(:last-child) {
  margin-bottom: 8px;
}
.accordion .tab-name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #292d34;
  position: relative;
  user-select: none;
  padding: 10px;
  border-radius: 8px;
  transition: all 0.5s ease;
}
@media (max-width: 400px) {
  .accordion .tab-name {
    font-size: 20px;
  }
}
.accordion .tab-name .chevron-icon {
  fill: #292d34;
  position: absolute;
  left: calc(100% - 10px);
  top: 50%;
  transform: translate(-100%, -50%);
  transition: all 0.5s ease;
}
.accordion .tab-content {
  user-select: none;
  color: #7c828d;
  max-height: 0;
  overflow: hidden;
  padding: 10px;
  font-size: 16px;
  border-radius: 9px;
  transition: all 0.5s linear;
  animation: slideDownReverse 0.25s ease forwards;
}
.accordion .tab.active .tab-name {
  color: white;
}
.accordion .tab.active .tab-content {
  color: white;
  max-height: 300px;
  animation: slideDown 1s ease-out forwards;
}
.accordion .tab.active .chevron-icon {
  transform: translate(-100%, -50%) rotate(180deg);
  fill: white;
}
.accordion .tab:nth-of-type(1).active .tab-name {
  background: linear-gradient(45deg, rgb(123, 66, 209) 0%, rgb(123, 104, 238) 100%);
  box-shadow: 0 10px 25px rgba(123, 66, 209, 0.4);
}
.accordion .tab:nth-of-type(1).active .tab-content {
  background: linear-gradient(45deg, rgb(123, 66, 209) 0%, rgb(123, 104, 238) 100%);
  box-shadow: 0 10px 25px rgba(123, 66, 209, 0.4);
}
.accordion .tab:nth-of-type(2).active .tab-name {
  background: linear-gradient(45deg, rgb(245, 205, 81) 0%, rgb(247, 206, 81) 100%);
  box-shadow: 0 10px 25px rgba(245, 205, 81, 0.4);
}
.accordion .tab:nth-of-type(2).active .tab-content {
  background: linear-gradient(45deg, rgb(245, 205, 81) 0%, rgb(247, 206, 81) 100%);
  box-shadow: 0 10px 25px rgba(245, 205, 81, 0.4);
}
.accordion .tab:nth-of-type(3).active .tab-name {
  background: linear-gradient(45deg, rgb(222, 23, 152) 0%, rgb(235, 61, 174) 100%);
  box-shadow: 0 10px 25px rgba(222, 23, 152, 0.4);
}
.accordion .tab:nth-of-type(3).active .tab-content {
  background: linear-gradient(45deg, rgb(222, 23, 152) 0%, rgb(235, 61, 174) 100%);
  box-shadow: 0 10px 25px rgba(222, 23, 152, 0.4);
}
.accordion .tab:nth-of-type(4).active .tab-name {
  background: linear-gradient(45deg, rgb(42, 179, 248) 0%, rgb(91, 197, 250) 100%);
  box-shadow: 0 10px 25px rgba(42, 179, 248, 0.4);
}
.accordion .tab:nth-of-type(4).active .tab-content {
  background: linear-gradient(45deg, rgb(42, 179, 248) 0%, rgb(91, 197, 250) 100%);
  box-shadow: 0 10px 25px rgba(42, 179, 248, 0.4);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0px);
  }
}
@keyframes slideDownReverse {
  from {
    opacity: 1;
    transform: translateY(0px);
  }
  to {
    opacity: 0;
    transform: translateY(-40px);
  }
}
.jssecrets {
  text-decoration: none !important;
  padding: 16px;
  background: #ffc805;
  color: #000000;
  font-size: 1em;
  border-radius: 8px;
  box-shadow: 0px 4px 12px rgba(184, 144, 0, 0.1882352941), 0px 8px 24px rgba(184, 144, 0, 0.3764705882);
  position: absolute;
  bottom: 24px;
  right: 24px;
  transition: all 0.3s;
}
.jssecrets:hover {
  transform: translateY(-4px);
}
              
            
!

JS

              
                // Variables
const tabs = document.querySelectorAll('.tab');

// Functions
const toggleTab = (event) => {
  event.currentTarget.classList.toggle('active');
};

// Event Listeners
tabs.forEach((tab) => {
  tab.addEventListener('click', toggleTab);
});

              
            
!
999px

Console