cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              <div class="container">
  <section class="screen left">
    <h1>Mens Fashion</h1>
    <button>
      <a href="#" class="button">Learn More</a>
     </button>
  </section>
  
  <section class="screen right">
    <h1>Womens Fashion</h1>
    <button>
      <a href="#" class="button">Learn More</a>
     </button>
  </section>
</div>
›
            
          
!
            
              
/** Variables **/

$container-BgColor: #444;
$left-bgColor: rgba(136, 226, 247, 0.7);
$left-button-hover: rgba(94, 226, 247, 0.7);
$right-bgColor: rgba(227, 140, 219, 0.8);
$right-button-hover: rgba(255, 140, 219, 0.7);
$hover-width: 75%;
$small-width: 25%;
$animateSpeed: 1000ms;


html, body {
  padding:0;
  margin:0;
  font-family: 'Open Sans', sans-serif;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

h1 {
  font-size: 5rem;
  color: #fff;
  position: absolute;
  left: 50%;
  top: 20%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: 'Playfair Display', serif;  
}

.button {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  height: 2.6rem;
  padding-top: 1.5rem;
  width: 15rem;
  text-align: center;
  color: white;
  border: 3px solid #fff;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateX(-50%);
  transition: all .2s;
}

.screen.left .button:hover {
  background-color: $left-button-hover;
  border-color: $left-button-hover;
}

.screen.right .button:hover {
  background-color: $right-button-hover;
  border-color: $right-button-hover; 
}

.container {
  position: relative;
  width: 100%;
  height: 100%;
  background: $container-BgColor;
  
    .screen {
      position: absolute;
      width: 50%;
      height: 100%;
      overflow: hidden;
    }
}

.screen.left {
  left:0;
  background: url('https://preview.ibb.co/cpabRm/pexels_photo_450212_1.jpg') center center no-repeat;
  background-size: cover;
  
    &:before {
       position:absolute;
      content: "";
      width: 100%;
      height: 100%;
      background: $left-bgColor;
    }
}

.screen.right {
  right:0;
  background: url('https://preview.ibb.co/mToPCR/seth_doyle_82563_1.jpg') center center no-repeat;
  background-size: cover;
  
   &:before {
      position:absolute;
      content: "";
      width: 100%;
      height: 100%;
      background: $right-bgColor;
    }
}


.screen.left, .screen.right, .screen.right:before, .screen.left:before {
  transition: $animateSpeed all ease-in-out;
}

.hover-left .left {
  width: $hover-width;
}

.hover-left .right {
  width: $small-width;
}

.hover-left .right:before {
  z-index: 2;
}

// Hover right screen

.hover-right .right {
  width: $hover-width;
}

.hover-right .left {
  width: $small-width;
}

.hover-right .left:before {
  z-index: 2;
}

/**** Responsive *****/

@media(max-width: 800px) {
  h1 {
    font-size: 2rem;
  }

  .button {
    width: 12rem;
  }
}

@media(max-height: 700px) {
  .button {
    top: 70%;
  }
}
            
          
!
            
              




















































const doc = document;
const right = doc.querySelector(".right");
const left = doc.querySelector(".left");
const container = doc.querySelector(".container");

// adds a class to the container element on hover
left.addEventListener("mouseenter", () => {
  container.classList.add("hover-left");
});

// removes the class that was added on hover
left.addEventListener("mouseleave", () => {
  container.classList.remove("hover-left");
});

right.addEventListener("mouseenter", () => {
  container.classList.add("hover-right");
});

right.addEventListener("mouseleave", () => {
  container.classList.remove("hover-right");
});

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console