Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                <!--This is needed somewhere on the page-->
<!--The JS clones the item, so stack classes as needed-->
<div class="tooltipOuter">
    <div class="tooltipInner"></div>
</div>
 
<div class="padding">Welcome to the Website
<!--Example-->
<span class="icon-help" data-ui-tooltip="Example Text in Tooltip. <br />Example Text on Second Line">?</span>
  </div>
              
            
!

CSS

              
                /* ToolTip */
.tooltipOuter {
    -webkit-box-shadow:  2px 2px 3px 0px #292926;
    box-shadow:  2px 2px 3px 0px #292926;
    position: absolute;
    z-index: 5000;
    display:block;
    top:200px;
    left:200px;
    min-width:130px;
    max-width:300px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    display:none;
}
.tooltipInner {
    background: #AAC44D;
    -webkit-box-shadow: inset 2px 2px 3px 0px #414D17;
    box-shadow: inset 2px 2px 3px 0px #414D17;
    padding: 0.75em;
    color:#292926;
    text-align: center;
    font-size: 12px;
    line-height: 16px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
}
.tooltipInner::before {
    content: " ";
    display: block;
    background-color: transparent;
    position: absolute;
    bottom: -6px;
    margin: 0 0 0 -10px;
    left: 50%;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #AAC44D;
}


/* example css */
.padding {
  padding:3em;
  position:relative;
}
.icon-help {
  cursor:pointer;
  font-size:11px;  
  background:#000;
  color:#fff;
  padding:0 0.25em;
  border-radius:40%;
}
              
            
!

JS

              
                $(document).ready(function(){
      tooltipObj.init();   
    });

var tooltipObj = {
    init: function(){
        this.events();
    },
    events: function(){
        var _this = this;
        $('[data-ui-tooltip]').on('mouseenter',function(e){
 
            var $el = $(this),
                text = $el.data("ui-tooltip");
            _this.mouseenterEvent(e, text, $el);
        });
 
        $('[data-ui-tooltip]').on('mouseleave click',function(e){
            _this.mouseleaveEvent(e);
        });
    },
    mouseenterEvent: function(e, text, $el){
 
        if(typeof text != 'undefined'){
 
            var tt      = $('.tooltipOuter').clone().addClass("temp"),
                ttCon   = $('.tooltipInner').clone(),
                offset  = $el.offset();
 
            tt.empty()
                .append(ttCon.html(text))
                .appendTo("body");
 
            //Calculate after append
            var bWidth  = tt.width() > $el.width() ? tt.width() :  $el.width(),
                lWidth  = tt.width() < $el.width() ? tt.width() :  $el.width(),
                dWidth  = bWidth - lWidth,
                topVal  = (offset.top - tt.height()) - 8,
                leftVal = (offset.left - (dWidth / 2));
 
            tt.css({
                top:topVal,
                left:leftVal
            }).fadeIn("fast");
        }
    },
    mouseleaveEvent: function(e){
        $('.tooltipOuter.temp').remove();
    }
}
 

  
  
              
            
!
999px

Console