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

              
                <h1>
  Tooltips <br />
  <small>Using Tether-tooltips</small>
</h1>
<hr />
<h2>Helper Tooltips</h2>
<div class="field">
  <label for="input1">Label input1</label>
  <input type="text" id="input1" />
  <div class="helper input1">
    <i class="ion-ios-help"></i>
  </div>
</div>

<div class="field">
  <div class="helper input2">
    <i class="ion-ios-help"></i>
  </div>
  <label for="input2">Label input2</label>
  <input type="text" id="input2" />
</div>

<div class="field">
  <label for="input3">Label input3</label>
  <input type="text" id="input3" />
  <div class="helper input3">
    <i class="ion-ios-help"></i>
  </div>
</div>
<hr />

<h2>Info Tooltip</h2>
<div class="field">
  <label for="input4">Label input4</label>
  <input type="text" id="input4"/>
  <div class="info input4">
    <i class="ion-ios-information"></i>
  </div>
</div>

<div class="field">
  <div class="info input5">
    <i class="ion-ios-information"></i>
  </div>
  <label for="input5">Label input5</label>
  <input type="text" id="input5"/>
</div>


<div class="field">
  <label for="input6">Label input6</label>
  <input type="text" id="input6"/>
  <div class="info input6">
    <i class="ion-ios-information"></i>
  </div>
</div>


              
            
!

CSS

              
                body{
  text-align: center;
  padding: 5%;
  font-family: sans-serif;
}
small{
  font-weight: 300;
}
.has-error{
  border: 1px solid red;
}
hr{
  width: 20%;
  margin: 50px auto;
}
.field{
  margin: 10px;
}
$orange: coral;

.helper{
  display: inline-block;
  color: $orange;
}

.info{
  display:inline-block;
  color: dodgerBlue;
}
.helper, .info{
  i{
    font-size: 1.4em;
  }
}

.tooltip-content{
  position: relative;
  background: white;
  text-align: left;
  padding: 15px;
  box-shadow: 0 0 5px rgba(black, 0.2);
  &:before{
    position: absolute;
    transform: translateY(-50%);
    content:'';
    width: 0; 
    height: 0; 
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;  
  }
  
  b{
    color: $orange;
  }
}

// HELP Tooltips
.help-right .tooltip-content{
  left: 15px; 
  border-left: 5px solid $orange; //1
  &:before{

    left:-15px; top:50%; //2
    border-right: 15px solid $orange; //3
  }
}
.help-left .tooltip-content{
  right:15px;
  border-right: 5px solid $orange; //1
  &:before{

    right:-15px; top:50%; //2
    border-left: 15px solid $orange; //3
  }
}

// WARNING Tooltips
.info-right .tooltip-content{
  left: 15px; 
  border-left: 5px solid dodgerBlue; //1
  &:before{
    left:-15px; top:50%; //2
    border-right: 15px solid dodgerBlue; //3
  }
}
.info-left .tooltip-content{
  right:15px;
  border-right: 5px solid dodgerBlue; //1
  &:before{
    right:-15px; top:50%; //2
    border-left: 15px solid dodgerBlue; //3
  }
}
              
            
!

JS

              
                var tooltip = {
  /**
  * Make a Tooltip
  **/
  make(target, content, orientation = 'right', type = 'help'){
    return new Tooltip({
      target: document.querySelector(target),
      content: content,
      classes: `tooltip ${type}-${orientation}`,
      position: `${orientation} middle`
    });
  },

  /**
  * Help tooltip
  **/
  help(t,c,o ='right'){
    return this.make(t,c,o,"help");
  },

  /**
  * Info Tooltip
  **/
  info(t,c,o ='right'){
    return this.make(t,c,o,"info");
  }
}

var input1Tooltip = tooltip.make(".input1","content");
var input2Tooltip = tooltip.help(".input2","content2","left");
var input3Tooltip = tooltip.help(".input3","Cette tooltips est a <b>droite!</b>");

var input4Tooltip = tooltip.make(".input4","Ceci est une information","right" ,"info");
var input5Tooltip = tooltip.info(".input5","Une info a gauche", "left");
var input6Tooltip = tooltip.info(".input6","last info<br>newline super longue de la mort qui tue<br>newline super longue de la mort qui tue<br>newline super longue de la mort qui tue<br>newline super longue de la mort qui tue");

              
            
!
999px

Console