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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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.

            
              <h1>CSS-only Tooltip</h1>
<p>
  This is just some filler text, but
<span class="tooltip tooltip-bottom" data-tip="yay, tooltip content! provided by your friendly data-* attribute">this thing has a tooltip</span> and here we have more filler text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</p>
<p>
  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim. This is just some filler text, but
<span class="tooltip" data-tip="yay, bottom tooltip content! provided by your friendly data-* attribute">this thing has a tooltip</span> and here we have more filler text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, <span class="tooltip" data-tip="yay, bottom content! provided by your friendly data-* attribute">quis</span> nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</p>
            
          
!
            
              // CSS-only Tooltip
// work in progress, still needs more testing. So far works well in Chrome, FF, Opera, Safari, IE9-11. 
// IE 8 seems to be ok, just don’t forget fallback colors and visibility: hidden.
// Goals: 
// - Make tooltip work across browsers including IE8
// - Tooltip shows up on either top or bottom of anchor (with extra class .tooltip-bottom added)
// - Tooltip supports multiple line text

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

*, *:before, *:after {
  -moz-box-sizing: border-box; 
  -webkit-box-sizing: border-box; 
  box-sizing: border-box;
}
// this is just for looks
body {
  margin: 1em 2em;
  line-height: 1.5;
  background-color: #EAEAEA;
  color: rgb(0,19,49);
  text-align: left;
  font-family: 'Montserrat', sans-serif;
}
p {
  max-width: 40em;
}

// variables
$tip-distance: 24px;
$tip-triangle-width: 6px;
$tip-color-fallback: #001331;
$tip-color: rgba(0,19,49,.9);
// style the tooltip anchor
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
  border-color: $tip-color-fallback; // IE8 fallback
  border-bottom: 1px dotted $tip-color;
  background-color: #EAEADE; // IE8 fallback
  background-color: rgba(255,255,0,.05);
    &:after {
      content: attr(data-tip);
      position: absolute;
      bottom: $tip-distance;
      left: -10px;
      min-width: 100px;
      max-width: 300px;
      padding: 5px 7px 5px 10px;
      pointer-events: none;
      font-size: .75em;
      background-color: $tip-color-fallback;
      background-color: $tip-color;
      color: #FFF;
      border-radius: 2px;
    }
    // this creates the little triangle
    &:before {
      content: "";
      width: 0;
      height: 0;
      position: absolute;
      left: 5px;
      bottom: $tip-distance - $tip-triangle-width;
      border-left: $tip-triangle-width solid transparent;
      border-right: $tip-triangle-width solid transparent;
      border-top: $tip-triangle-width solid $tip-color-fallback; // IE8 fallback
      border-top: $tip-triangle-width solid $tip-color;
    }
    &:before,  
    &:after {
      display: block;
      visibility: hidden; // because opacity:0 is not enough for IE8
      opacity: 0;  
      transition: opacity 0.2s ease-out, margin 0.2s ease-out;
    }
    &:hover {
      color: #999;
      &:before,  
      &:after {
        opacity: 1;
        margin-bottom: 3px;
        visibility: visible;
      }
    }
}

.tooltip-bottom {
  &:after {
    top: $tip-distance;
  }
  &:before {
    top: $tip-distance - $tip-triangle-width;
    border-top: 0;
    border-left: $tip-triangle-width solid transparent;
    border-right: $tip-triangle-width solid transparent;
    border-bottom: $tip-triangle-width solid $tip-color-fallback; // IE8 fallback
    border-bottom: $tip-triangle-width solid $tip-color;
  }
  &:hover {
    &:before,  
    &:after {
      bottom: auto;
      margin-bottom: 0;
      margin-top: 3px;
    }
  }
}
            
          
!
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