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

              
                <div class="bg-wrapper">
  <!-- content top -->
  <section class="top-content">
    <span>
      <a href="javascript:void(0)">
        <img src="http://sarabianchi.it/code-images/landing-page/logo.png">
      </a>
    </span>
    <span>
      <a href="javascript:void(0)">
        <img class="menu" src="http://sarabianchi.it/code-images/landing-page/menu-icon.png">
      </a>
    </span>
  </section>
  
  <!-- content bottom -->
  <section class="bottom-content">
    <div class="content-left">
      <h1 class="title">Balloons Festival</h1>
      <p>Venture into a magnificent mountain scenery by flying silently in a hot air balloon, it’s an experience not to be missed!</p>
      <button>Buy the Ticket</button>
    </div>
    
    <div class="content-right">
      <p>15th July 2016 | 9:00am - 6:00pm<br>
      Grand Teton National Park<br>
      Tel: 089 876394</p>
    </div>
  </section>
  
  <!-- parallax background -->
  <div class="bg"></div>
</div>

              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Lobster);
@import url(https://fonts.googleapis.com/css?family=Montserrat);

$font-p: 'Montserrat', sans-serif;
$font-title: 'Lobster', cursive;
$text-shadow: 1px 2px 10px rgba(0,0,0,0.3);
$box-shadow: 0px 0px 30px 12px rgba(0,0,0,0.1);

* {
  margin: 0px;
  padding: 0px;
}

.bg-wrapper {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  
  .bg {
    height: 109%;
    width: 106%;
    background: url(http://sarabianchi.it/code-images/landing-page/balloons.jpg) no-repeat;
    background-size: cover;
    position: absolute;
    top: -25px;
    left: -25px;
    z-index: -99;
  }
}

.top-content {
  display: flex;
  width: 100%;
  
  span {
    flex-grow: 1;
    margin: 50px 70px;
    display: flex;
    
    &:last-child {
      align-items: center;
      justify-content: flex-end;
    }
    
    @media (max-width: 575.98px) {
      margin: 50px 30px;
    }
  }
}

.menu {
  background: rgba(white, .3);
  padding: 8px;
  transition: all .15s linear;
  border: 1px solid white;
  box-shadow: $box-shadow;

  &:hover {
    background: rgba(white, .5);
    box-shadow: none;
  }
}

.bottom-content {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  padding: 50px 70px;
  margin-top: auto;
  width: 100%;
  
  @media (max-width: 575.98px) {
    padding: 50px 30px;
  }
  
   p {
    color: white;
    font-family: $font-p;
    line-height: 27px;
    font-size: 17px;
    margin: 7px 0px 23px 0px;
    text-shadow: $text-shadow;
     
     @media (max-width: 575.98px) {
      font-size: 14px;
    }
  }
}

.content-left {
  flex-grow: 1;
  text-align: center;
  max-width: 750px;
  
  .title {
    font-family: $font-title;
    color: #fff;
    font-size: 60px;
    text-shadow: $text-shadow;
    
    @media (max-width: 575.98px) {
      font-size: 40px;
    }
  }
}

.content-right {
  flex-grow: 1;
  text-align: right;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  
  @media (max-width: 991.98px) {
    text-align: center;
    justify-content: center;
  }
  
  p {
    margin: 20px 0; 
    line-height: 30px;
    
  }
}

button, 
button:visited, 
button:focus {
  cursor: pointer;
  border: 1px solid white;
  background: rgba(white, .3);
  width: 160px;
  padding: 15px 0px;
  color: white;
  font-family: $font-p;
  font-size: 18px;
  box-shadow: $box-shadow;
  transition: all 0.2s linear;
  outline: none;

  &:hover {
    box-shadow: none;
    background: rgba(white, .5);
  }
}
              
            
!

JS

              
                $('.bg-wrapper').on('mousemove', function(e) {
  mouseX = e.pageX, mouseY = e.pageY, moveFactor = 50, windowWidth = $(this).width(), windowHeight = $(this).height();
  percentX = ((mouseX / windowWidth) * moveFactor - moveFactor / 2);
  percentY = ((mouseY / windowHeight) * moveFactor - moveFactor / 2);
  leftString = percentX + "px";
  topString = percentY + "px";
  if (percentX < (windowWidth / 2)) {
    leftString = -percentX + "px";
  }

  if (percentY < (windowHeight / 2)) {
    topString = -percentY + "px";
  }

  bgPos = leftString + " " + topString;
  $(this).find('.bg').attr("style", "background-position: " + bgPos);

});
              
            
!
999px

Console