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

              
                <button class="switch-mode">
  <svg class="sun" fill="none" stroke="#fbb046" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="feather feather-sun" viewBox="0 0 24 24"><defs/><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>
  <svg class="moon" fill="none" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="feather feather-moon" viewBox="0 0 24 24"><defs/><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg>
</button>
<div class="wrapper">
  <a href="#" class="item-link active">
    <span>
      <svg class="link-icon" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="feather feather-home" viewBox="0 0 24 24"><defs/><path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/><path d="M9 22V12h6v10"/></svg>
    </span>Home</a>
  <a href="#" class="item-link">
    <span><svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg></span>
    Profile</a>
  <a href="#" class="item-link">
    <span><svg class="link-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bell"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>
    </span>Notifications</a>
  <a href="#" class="item-link">
    <span><svg class="link-icon" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="feather feather-settings" viewBox="0 0 24 24"><defs/><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 01-2-2 2 2 0 012-2h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 010-2.83 2 2 0 012.83 0l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z"/></svg></span>Settings</a>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;500&display=swap');

* {
  box-sizing: border-box;
}

:root {
  font-family: 'Comfortaa', cursive;
}

body {
  --bg-color: #f3f4f4;
  --link-color: #7c7f8e;
  --link-hover-color: #242a37;
  --link-active-1: #ff4350;
  --wrapper-bg: #fff;
  --box-shadow: 0px 0px 10px 6px rgba(235,235,235,.6);
  
  margin: 0;
  width: 100%;
  height: 100vh;
  background-color: #f3f4f4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-color);
  transition: background .3s ease-in;
}

body.dark {
  --bg-color: #333a48;
  --link-color: #b0b4c7;
  --link-hover-color: #b5bbd0;
  --link-active-1: #ff4350;
  --wrapper-bg: #242a37;
  --box-shadow: 0px 0px 8px 0px #282b33;
}

.wrapper {
  background-color: var(--wrapper-bg);
  padding: 0 40px;
  flex-shrink: 0;
  border-radius: 6px;
  box-shadow: var(--box-shadow);
  height: 60px;
  display: flex;
  align-items: center;
  transition: all .3s ease-in;
}

.item-link {
  position: relative;
  display: flex;
  align-items: center;
  color: #7c7f8e;
  text-decoration: none;
  padding: 18px 0;
  margin: 0 10px;
  letter-spacing: .5px;
  
  &:before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background-color: var(--link-hover-color);
    z-index: 2;
    width: 0;
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  
  &:not(.active):hover:before {
    width: 100%;
    opacity: 1;
  }
  
  &:not(.active):hover {
    color: var(--link-hover-color);
  }
  
  &.active:before { width: 100%; }
}

.active:first-child {
  color: var(--link-active-1);
  
  &:before { background-color: var(--link-active-1); }
  
  svg {
    transition: all .2s ease-in;
    transform: scale(1.1);
  }
}

.active:nth-child(2){
  color: #fbb046;
  
  &:before { background-color: #fbb046; }
  
  svg circle {
    animation: headbang .3s ease-in both;
  }
}

@keyframes headbang {
  0% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(2px, 0 , 0); }
  50% { transform: translate3d(0, 0 , 0); }
  75% { transform: translate3d(-2px, 0, 0);}
  100% { transform: translate3d(0 , 0, 0); }
}

.active:nth-child(3){
  color: #47caa4;
  
  &:before { background-color: #47caa4; }
  
  svg path {
    animation: shake .6s cubic-bezier(.36,.07,.19,.97) both;
  }
  
  svg path:nth-child(2) {
    animation-delay: .1s;
  }
}

@keyframes shake {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }

  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);
  }

  40%, 60% {
    transform: translate3d(4px, 0, 0);
  }
}

.active:nth-child(4){
  color: #495fcc;
  
  &:before { background-color: #495fcc; }
  
  svg {
    transition: .3s ease-in-out;
    transform: rotate(360deg);
  }
}

.link-icon {
  width: 20px;
  height: 18px;
  margin-right: 4px;
  flex-grow: 0;
}

.switch-mode {
  position: absolute;
  top: 20px;
  right: 20px;
  background-color: transparent;
  border: none;
  color: #ddd;
  outline: none;
  cursor: pointer;
  
  svg {
    width:0;
    height: 24px;
    transition: all .3s ease-in;
    transform-origin: center;
  }
  
  .moon { opacity: 0; }
  .sun { width: 24px; }
}

.dark .moon {
  opacity: 1;
  width: 24px;
}

.dark .sun {
  opacity: 0;
  width: 0;
}

@media screen and (max-width: 580px) {
  .wrapper {
    transform: scale(.8);
  }
  
  .switch-mode {
    right: 8px;
  }
}

@media screen and (max-width: 520px) {
  .wrapper {
    transform: scale(.6);
  }
}
              
            
!

JS

              
                $(document).ready(function(){
  $('a').click(function(){
    $('a').removeClass("active");
    $(this).addClass("active");
  });
  $('button').click(function(){
    $('body').toggleClass('dark');
  });
});
              
            
!
999px

Console