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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                header.parallax
  h1 This is a test of that no-JS parallax effect
section
  h2 Some second heading
  p This code was adapted from <a href="https://www.youtube.com/watch?v=6CQ7DYni7Bg" target="_blank" rel="noopener">Codegrid's excellent little Youtube video</a> from last year. You should check it out. I only made this as a test of a mobile code-sketching setup. Codepen works great on phones! So I just propped mine up in a cupholder on my bus to New York, hooked it up to a bluetooth keyboard, and sketched this and two other little things up. So fun, highly recommend it for young ones looking to get into this. You do not need a bunch of fancy stuff to learn web development.
section.parallax.img-2
  h3 A quote can always cover awkward silence.
section
  h2 Now this is a story
  p All about how my life got flipped, turned upside down, and I'd like to take a minute - just sit right there - tell ya how I became the prince of a town called "Bel Air."
section.parallax.img-3
  h3 How is the weather?
  
  
//- Remember to update the href attribute to this pen!
a#twitter-link.social-link(target="_blank" href="https://twitter.com/intent/tweet?text=Check%20out%20this%20pen%20by%20@FrankNoirot&via=CodePen%20&hashtags=codepen%2cfrontend&url=https://codepen.io/franknoirot/full/ZdojyM")
  .social-badge
    span Share
    svg#twitter-icon.social-icon(xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 24 24")
      title Twitter icon
      path(d="M23.954 4.569c-.885.389-1.83.654-2.825.775 1.014-.611 1.794-1.574 2.163-2.723-.951.555-2.005.959-3.127 1.184-.896-.959-2.173-1.559-3.591-1.559-2.717 0-4.92 2.203-4.92 4.917 0 .39.045.765.127 1.124C7.691 8.094 4.066 6.13 1.64 3.161c-.427.722-.666 1.561-.666 2.475 0 1.71.87 3.213 2.188 4.096-.807-.026-1.566-.248-2.228-.616v.061c0 2.385 1.693 4.374 3.946 4.827-.413.111-.849.171-1.296.171-.314 0-.615-.03-.916-.086.631 1.953 2.445 3.377 4.604 3.417-1.68 1.319-3.809 2.105-6.102 2.105-.39 0-.779-.023-1.17-.067 2.189 1.394 4.768 2.209 7.557 2.209 9.054 0 13.999-7.496 13.999-13.986 0-.209 0-.42-.015-.63.961-.689 1.8-1.56 2.46-2.548l-.047-.02z")

              
            
!

CSS

              
                :root {
  font-family: 'Roboto', sans-serif;
}

h1,h2,h3,h4,h5,h6 {
  font-family: "Roboto Slab", serif;
  color: limegreen;
  --h-size-min: 1.4em;
  --h-w-min: 21;
  --h-w-max: 35;
  --h-w-diff: calc(var(--h-w-max) - var(--h-w-min));
  --h-size-w-min: calc(var(--h-w-min) * 1em);
  --h-factor: 1;
  
  font-size: calc(var(--h-size-min) * var(--h-factor) + .1 * (100vw - var(--h-size-w-min)) / var(--h-w-diff));
}

h1 { --h-factor: 2.25; }
h2 { --h-factor: 2; }
h3 { --h-factor: 1.75; }
h4 { --h-factor: 1.5; }
h5 { --h-factor: 1.25; }

p {
  --p-line-height-min: 1.3em;
  --p-w-max: 35;
  --p-w-min: 21;
  --p-w-diff: calc(var(--p-w-max)-var(--p-w-min));
  --p-line-height-w-min: calc(var(--p-w-min) * 1em);
  
  line-height: calc(var(--p-line-height-min) + .75 * (100vw - var(--p-line-height-w-min)) / var(--p-w-diff));
}

html {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  background: white;
  margin: 0;
  padding: 0;
  height: 100%;
  transform-style: preserve-3d;
  perspective: 1px;
  overflow-y: scroll;
  overflow-x: hidden;
}

.parallax {
  min-height: 100vh;
  width: 100vw;
  display: flex;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5vw;
  transform-style: inherit;
  box-sizing: border-box;
  overflow: hidden;
}

.parallax, .parallax::after {
  background: 50% 50% / cover;
}

.parallax::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: block;
  background: url(https://franknoirot.co/assets/img/furniture/5.jpg);
  background-size: cover;
  transform-origin: 50% 50% 0;
  transform: translateZ(-1px)  scale(2);
  z-index: -1;
  min-height: 100vh;
}

.img-2::after { background: url(https://franknoirot.co/assets/img/furniture/6.jpg); }
.img-3::after { background: url(https://franknoirot.co/assets/img/furniture/1.jpg); }

.paralkax * {
  filter: drop-shadow(0 .2em ..05em rgba(50,50,50,0.2));
}

section:not(.parallax) {
  background: white;
  box-sizing: border-box;
  padding: 5vmin 5vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}




/* Share badge styles */
.social-badge {
  --twitter-primary:#55acee;
  --twitter-dark: #292f33;
  --twitter-light: #e1e8ed;
  position: fixed;
  padding: .5em 1em;
  border-radius: 1em;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 5em;
  background: var(--twitter-dark);
  color: var(--twitter-light);
  font-weight: 500;
  box-shadow: 0 4px 1px var(--twitter-light);
  transition: all .2s ease-in-out;
}

a .social-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 3px var(--twitter-light);
}

.social-badge .social-icon {
  display: inline-block;
  height: 1.5em;
}

.social-icon path {
  fill: var(--twitter-light);
}

.social-badge span {
  text-transform: uppercase;
  vertical-align: middle;
}


/* Media Queries */
@media only screen and (max-width: 500px){
  .social-badge {
    width: inherit;
  }
  .social-badge span {
    display: none;
  }
}
              
            
!

JS

              
                // 🤖 These are not the droids you're looking for. 🤖
              
            
!
999px

Console