Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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

Save Automatically?

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

              
                <body>
  <div class="centered">
    <div class="onboarding-card card-1">
      <div class="overlay">
        <button class="go"><div>GO
<svg viewBox="0 0 24 24">
    <path d="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z" />
          </svg></div>
</button>
        <div class="text-container">
          <div class="title">Plan your trip to Singapore</div>
          <div class="subtitle">Check out<br>must-see places</div>
        </div>
      </div>
    </div>
    <div class="onboarding-card card-2">
      <div class="overlay">
        <button class="go"><div>GO
<svg viewBox="0 0 24 24">
    <path d="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z" />
          </svg></div>
</button>
        <div class="text-container">
          <div class="title">Find out the best food</div>
          <div class="subtitle">Local faves & internationally acclaimed</div>
        </div>
      </div>
    </div>
    <div class="onboarding-card card-3">
      <div class="overlay">
        <button class="go"><div>GO
<svg viewBox="0 0 24 24">
    <path d="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z" />
          </svg></div>
</button>
        <div class="text-container">
          <div class="title">Visit Singapore</div>
          <div class="subtitle">Where passion and possibilities meet</div>
        </div>
      </div>
    </div>
  </div>
</body>
              
            
!

CSS

              
                /* Lovely photos taken from unsplash:
https://unsplash.com/photos/4HVCsDOg0qI
https://unsplash.com/photos/Rl6Xep37xS0
https://unsplash.com/photos/HA1jee1s9qg */

@import url(https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700);

body {
  font-family: 'Montserrat', sans-serif;
  color: white;
  background: #eee;
}
  
.centered {
  margin: auto;
  transform: translateY(25%);
  position: relative;
  width: 320px;
  height: 500px;
  background: black;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.25);
}

button.go {
  all: unset;
  background: red;
  border-radius: 50%;
  width: 180px;
  height: 170px;
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  transform: translate(50%, 50%);
  padding: 32px;
  font-size: 18px;
  font-weight: 700;
  line-height: 32px;
  animation: pulse 2s linear infinite;
}

@keyframes pulse {
  50% {
    width: 190px;
    height: 175px;
  }
}

button.go div{
  height: 50%;
  width: 50%;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}

button.go svg {
  fill: white;
  width: 32px;
  height: 32px;
}

.onboarding-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: opacity .5s ease-in-out;
  box-sizing: border-box;
}

.card-1 {
  background: url(https://images.unsplash.com/photo-1441805983468-f5a1a9f985fb?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=65b49a8133d1ad48e0ffaf39661a6329&auto=format&fit=crop&w=1050&q=80);
  background-position: center;
  background-size: cover;
}

.card-2 {
  background: url(https://images.unsplash.com/photo-1496136998968-81293d01179b?ixlib=rb-0.3.5&s=6e0355e30f0094f54a745198755868ea&auto=format&fit=crop&w=334&q=80);
  background-size: cover;
}

.card-3 {
  background: url(https://images.unsplash.com/photo-1490105171842-5fab28613c56?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=1272b93664e358f658989443ff6518d7&auto=format&fit=crop&w=1050&q=80);
  background-position: center;
  background-size: cover;
}

.overlay {
  position: absolute;
  background: linear-gradient(rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 1));
  height: 100%;
  width: 100%;
  z-index: 1;
}

.text-container {
  position: absolute;
  max-width: inherit;
  height: 50%;
  top: 60%;
  padding: 16px;
  z-index: 3;
}

.title {
  font-size: 18px;
  font-weight: 700;
}

.subtitle {
  font-size: 28px;
  font-weight: 500;
  margin-top: 8px;
}

              
            
!

JS

              
                var slideIndex = 0;
carousel();

function carousel() {
    var i;
    var x = document.getElementsByClassName("onboarding-card");
    for (i = 0; i < x.length; i++) {
      x[i].style.opacity = "0"; 
    }
    slideIndex++;
    if (slideIndex > x.length) {slideIndex = 1} 
    x[slideIndex-1].style.opacity = "1"; 
    setTimeout(carousel, 5000);
}
              
            
!
999px

Console