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="phone">
  <div class="time">11:11</div>
  <div class="panels">
    <div class="day-panel active" data-panel="day11">
      <div class="day">Today</div>
      <div class="date">11 December</div>
      <div class="icon rain">&#x1F327</div>
      <div class="temperature">15º</div>
      <div class="weather">Rain</div>
    </div>
    <div class="day-panel" data-panel="day12">
      <div class="day">Today</div>
      <div class="date">12 December</div>
      <div class="icon rain">&#x1F326</div>
      <div class="temperature">18º</div>
      <div class="weather">Sunny with chance of rain</div>
    </div>
  </div>
  
  <div class="btn-group">
    <button data-panel="day11" class="active">Today</button>
    <button data-panel="day12">Tomorrow</button>
  </div>
</div>
              
            
!

CSS

              
                $white: #ffffff;
$black: #000000;

@keyframes icon-loop {
    0% {
        font-variation-settings: 'wght' 100;
    }
    100% {
        font-variation-settings: 'wght' 900;
    }
}

* {
    box-sizing: border-box;
}

body {
	padding: 50px;
	margin: 0;
	background: $black;
  font-size: 18px;
  font-family:  Helvetica, Tahoma, sans-serif;
  font-weight: 300;
  color: $white;
}

.phone {
  background-image: url('https://www.kobufoundry.com/files/themes/foundry_theme/shortcodes/02_variable_icon_applications/images/phone_frame.svg');
  background-size: contain;
  background-position: top left;
  background-repeat: no-repeat;
  width: 340px;
  height: 574px;
  position: relative;
  
  .time {
    position: absolute;
    top: 23px;
    font-size: 0.77rem;
    left: 50%;
    width: 70px;
    margin-left: -35px;
    text-align: center;
  }
  
  .day-panel {
    transition: opacity .5s ease-in-out, visibility .5s ease-in-out;
    position: absolute;
    top: 7vw;
    width: 100%;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    
    &.active {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;

      .icon {
        animation: icon-loop 1s linear infinite alternate;
      }
    }
    
    .day {
      font-size: 1.44rem;
      font-weight: 300;
      margin-bottom: 3px;
    }

    .date {
      font-size: 0.66rem;
      margin-top: 3px;
    }

    .icon {
      font-variation-settings: 'wght' 100;
      font-family: 'KyodoSlabGX', sans-serif;
      font-size: 10.7vw;
      height: 9vw;
      line-height: 7.5vw;
      margin-top: 2.5vw;
      margin-bottom: 2vw;  
    }
    
    .temperature {
      font-size: 2.11rem;
    }

    .weather {
      font-size: .88rem;
      max-width: 150px;
      margin-left: auto;
      margin-right: auto;
      line-height: 1.2;
      margin-top: 3px;
    }
  }
  
  .btn-group {
    text-align: center;
    position: absolute;
    bottom: 65px;
    display: block;
    left: 0;
    width: 100%;
    
    button {
      transition: background-color .5s ease-in-out, color .5s ease-in-out;
      display: block;
      font-size: 0.77rem;
      padding: 5px 15px;
      border-radius: 18px;
      z-index: 10;
      cursor: pointer;
      border: 1px solid $white;
      background-color: transparent;
      color: $white;
      margin-right: 20px;
      display: inline-block;

      &:focus {
        outline: none;
      }

      &:hover,
      &.active{
        color: $black;
        background-color: $white;
      }
      
      &:last-child {
        margin-right: 0;
      }
    }
  }
}
              
            
!

JS

              
                var buttons = document.querySelectorAll(".btn-group button");

function changePanel() {
  var panel = this.dataset.panel;
  var activePanelsButtons = document.querySelectorAll(".day-panel.active, .btn-group button.active");
  
  activePanelsButtons.forEach( function( elem ) {
    elem.classList.remove("active");
  } );
  
  this.classList.add("active");
  document.querySelector('.day-panel[data-panel="' + panel + '"]').classList.add("active");
}

buttons.forEach( function( button ) {
  button.addEventListener("click", changePanel, false); 
} );
              
            
!
999px

Console