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="row">
  <div class="small-12 medium-4 column">
  
 <!--This is the important block of code for the hover effect. The rest were replicated to demonstrate that it works in a grid system. ***You don't need Foundation to make this work.***-->
    <div class="box">
      <div class="overlay">
        <p class="hover-text">This is sample hover text</p>
        <a class="custom-button" href="http://myzerly.com" target="_blank">click me</a>
      </div>
    </div>
<!-- End code block-->
    
  </div>
  <div class="small-12 medium-4 column">
    <div class="box">
      <div class="overlay">
        <p class="hover-text">This is sample hover text</p>
        <a class="custom-button" href="http://myzerly.com" target="_blank">click me</a>
      </div>
    </div>
  </div>
  <div class="small-12 medium-4 column">
    <div class="box">
      <div class="overlay">
        <p class="hover-text">This is sample hover text</p>
        <a class="custom-button" href="http://myzerly.com" target="_blank">click me</a>
      </div>
    </div>
  </div>
</div>
            
          
!
            
              //Sets up the invisible overlay that shows on hover.
.overlay {  
  background:rgba(0,0,0,.75);
  height: 100%;
  opacity:0;
  transition: opacity .25s ease-out;
}

//sets up the overlay to have a hover effect that changes the opacity so you can see it.
.box:hover {
  .overlay { 
    opacity:1;
  }
}

//This is potential styling for the content you insert into the hover state overlay
.hover-text {
  font-family:Helvetica;
  font-weight:900;
  color:rgba(255,255,255,.85);
  font-size:16px;
  padding: 15px;
}

//"box" generates the binding parent element for the on-hover overlay as well as the background image. It uses the "contain" property to ensure that the background stays within the constraints of the parent element.
.box {
  height: 175px;
  width: 200px;
  background-image: url(http://myzerly.com/img/solidify-sketches/hotspot-4.png);
  background-position:50% 50%; 
  background-repeat: no-repeat;
  background-size: contain;
}

//Button styling- "custom-button" to overwrite Foundation styles- irrelevant to hover effect generation
.custom-button {
  border: 2px solid #fff;
  border-radius: 10px;
  height: 20px;
  width: auto;
  padding: 5px;
  color: #fff !important;
}

//separates positional styling for both the "box" and "overlay" selectors to emphasize the necessary code.
.box {
  margin-top: 5rem;
  margin-bottom: 2rem;
  margin-right: auto;
  margin-left: auto;
}

.overlay {
  text-align:center;
  padding-top: 30px;
  padding-bottom: 50px;
}

            
          
!
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