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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              section
  h1 Automatic Tooltips
  p 
    | Tooltips can be 
    span( class="TooltipTrigger", data-tooltips = "Attached", data-position = "OnTop" ) attached
    |  to any element. When you hover the 
    span( class="TooltipTrigger", data-tooltips = "Element to something", data-position = "OnBottom" ) element
    |  with your mouse, the title attribute is displayed in 
    span( class="TooltipTrigger", data-tooltips = "A little box to something to make it longer", data-position = "OnLeft" ) a little box
    |  next to the element, just like a native tooltip. But as it's not a native tooltip, it can be styled. Any themes built with 
    span( class="TooltipTrigger", data-tooltips = "Theme Roller to something", data-position = "OnRight" ) ThemeRoller
    |  will also style tooltips accordingly. Tooltips are also useful for form elements, to show some additional information in the context of each field.    

            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,700);
body {
  margin: 0;
  padding: 0;
  font-family: 'Open Sans', sans-serif;
  font-weight: 300;
  font-size: 16px;
  position: relative;
  text-align: center;
  color: #494949;
}

section {
  width: 400px;
  margin: 90px auto;
}

h1 {
  display: inline-block;
  font-weight: 700;
  font-size: 2rem;
  line-height: 2.8rem;
  border-bottom: 5px solid #67C8EA;
}

p {
  text-align: left;
  font-size: 1rem;
  line-height: 2;
  margin-top: 2rem;
}

span {
  border-bottom: 3px solid #67C8EA;
  cursor: pointer;
  transition: all 0.3s ease;
  &:hover {
    background: #A4E1F6;
  }
}

.Tooltips {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  &:hover p {
    visibility: visible;
    opacity: 1;
  }
  &:hover p.OnTop {
    transform: translate(-50%, -100%);
  }
  &:hover p.OnBottom {
    transform: translate(-50%, 100%);
  }
  &:hover p.OnLeft {
    transform: translate(-100%, -50%);
  }
  &:hover p.OnRight {
    transform: translate(100%, -50%);
  }
  p {
    min-width: 100px;
    opacity: 0;
    display: inline-block;
    visibility: hidden;
    position: absolute;
    text-align: left;
    width: auto;
    background: #67C8EA;
    color: #ffffff;
    font-size: 1rem;
    line-height: 1.2;
    padding: 10px;
    border-radius: 3px;
    white-space: normal;
    // white-space: nowrap; // Uncomment this line if you want to break line
    box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease-out;
    &.OnTop {
      top: -45px;
      left: 50%;
      transform: translate(-50%, -150%);
      &:before {
        position: absolute;
        content: "";
        width: 0;
        height: 0;
        border-top: 8px solid #67C8EA;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        bottom: -8px;
        margin-left: -8px;
        left: 50%;
      }
    }
    &.OnBottom {
      bottom: -15px;
      left: 50%;
      transform: translate(-50%, 150%);
      &:before {
        position: absolute;
        content: "";
        width: 0;
        height: 0;
        border-bottom: 8px solid #67C8EA;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        top: -8px;
        margin-left: -8px;
        left: 50%;
      }
    }
    &.OnLeft {
      left: -15px;
      top: -15px;
      transform: translate(-150%, -50%);
      &:before {
        position: absolute;
        content: "";
        width: 0;
        height: 0;
        border-left: 8px solid #67C8EA;
        border-top: 8px solid transparent;
        border-bottom: 8px solid transparent;
        top: 50%;
        margin-top: -8px;
        right: -8px;
      }
    }
    &.OnRight {
      right: -15px;
      top: -15px;
      transform: translate(150%, -50%);
      &:before {
        position: absolute;
        content: "";
        width: 0;
        height: 0;
        border-right: 8px solid #67C8EA;
        border-top: 8px solid transparent;
        border-bottom: 8px solid transparent;
        top: 50%;
        margin-top: -8px;
        left: -8px;
      }
    }
  }
}
            
          
!
            
                  // Initialize
    var Tooltips = document.getElementsByClassName('TooltipTrigger');

    // Track all tooltips trigger
    for (var i = 0; i < Tooltips.length; i++) {

      // Event Handler
      Tooltips[i].addEventListener("mouseenter", function(ev) {
        ev.preventDefault();
        this.style.position = "relative";
        this.innerHTML = this.innerHTML + "<div class='Tooltips'><p class='" + this.getAttribute("data-position") + "'>" + this.getAttribute("data-tooltips") + "</p></div>";
      });
      Tooltips[i].addEventListener("mouseleave", function(ev) {
        ev.preventDefault();
        this.removeAttribute("style");
        this.innerHTML = this.innerHTML.replace(/<div[^]*?<\/div>/, '');;
      });

    }
            
          
!
999px
Loading ..................

Console