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>Field tooltips</h1>
<h2>Requirements</h2>
<ul>
  <li>tooltip appears on hover via an icon</li>
  <li>should be available to keyboard users as well (eg on focus)</li>
  <li>useful to SR users to describe the input</li>
  <li>No JS!</li>
  <li>for mobile support (which would required JS), see <a href="https://codepen.io/mpiotrowicz/pen/MYQMdb" target="_blank">this example</a>
</ul>

<label for="address">
  <span class="visuallyhidden">Address</span>
</label>

<input id="address" type="text" placeholder="address" aria-describedby="Tooltip" />

<span tabindex="0" class="btn-tooltip" id="Tooltip" role="tooltip">
  <i class="fa fa-bolt icon" aria-hidden="true"></i>
  <span class="tooltip-content">here's some information.</span>
</span>
              
            
!

CSS

              
                // font awesome added for icon
// maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css

body {
  padding: 20px;
}

ul {
  margin-bottom: 20px;
}

input {
  padding: 5px;
  border: 1px solid #999;
  border-radius: 2px;
}

.visuallyhidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

.showvisuallyhidden {
  clip: auto;
  overflow: visible;
}

.btn-tooltip {
  border: none;
  background: none;
  position: relative;
}

.tooltip-content {
  @extend .visuallyhidden;
  height: auto;
  display: block;
  position: absolute;
  
  // styling specific to this example
  bottom: 130%;
  left: 50%;
  z-index: 200;
  width: 180px;
  margin: 0 0 5px -90px;
  padding: 0.75em 1em;
  text-align: center;
  color: #FFF;
  font-size: 12px;
  border-radius: 4px;
  background-color: #474747;
  
  transition: all 0.3s cubic-bezier(0.3, 0, 0, 1);
  transform: rotateX(20deg) scale(0.8);
  transform-origin: center 120%;
  -webkit-backface-visibility: hidden;
  opacity: 0;
}

.btn-tooltip {
  display: inline-block;
  text-align: center;
  // nice big hit area
  min-width: 40px;
  &:focus,
  &:hover {
    .tooltip-content {
      @extend .showvisuallyhidden;
      
      // styling specific to this example
      transform: rotateX(0deg) scale(1);
      opacity: 1;
    }
  }
}


::-webkit-input-placeholder {
 color: #767676;
}
::-moz-placeholder {  
 color: #767676;
} 
              
            
!

JS

              
                	
              
            
!
999px

Console