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

              
                <div class="row">
  <h1 class="title--blue">Pure CSS Tooltips</h1>
  <h2 class="title--blue">Inside <em>span</em> elements</h2>
  </div>
    <p>A lot of web sites use JavaScript to create tooltip but is actually easier doing that with CSS. This is a <span class="tooltip" data-tooltip="The HTML <span> element is a generic inline container for phrasing content, which does not inherently represent anything.">span</span> element inside a paragraph. You can <em>hover it</em> to look at the tooltip. Use <code>data-tooltip</code> where you want in your HTML code.  To show the content put <code>content</code> property equal to the <code>attr()</code> inside the pesudo element and style as you like.</p>
  </div>
</div>

<h2 class="title--blue">Inside a link as well</h2>
<p>Insert the <code>data-tooltip</code> inside the <a class="tooltip" href="#" data-tooltip="Links is an open source text and graphic web browser with a pull-down menu system.">link</a> and use the same style used for the <em>span</em> or other HTML elements.</p>
              
            
!

CSS

              
                @import 'https://fonts.googleapis.com/css?family=Lato|Oswald';

@import "susy";

body {
  @include container(60%);
  font-family: 'lato';
  font-weight: 200;
  background: #F1C40F;
  font-size: 1.4em;
  line-height: 1.5em;
}

h1 {
  font-size: 3em;
  text-align: center;
  padding-bottom: 10%;
}

h2{
  font-size: 2.2em;
}

.title--blue {
  font-family: 'Oswald';
  color: #4862A3;
  margin: 0;
  line-height: 1em;
}

.tooltip{
  position: relative;
  color: #3B627E;
  font-weight: bolder;
  cursor: pointer;
  &:hover::before{
    content: "";
    border: solid transparent;
    border-bottom-color: white;
    color: black;
    border-width: 10px;
    position: absolute;
    top: 20px;
  }
  
  &:hover::after{
    content: attr(data-tooltip);
    position: absolute;
    min-width: 15em;
    font-weight: 100;
    line-height: 1.3em;
    margin: 0;
    background: #4862A3;
    color: #fff;
    padding: 15px;
    border-radius: 5px;
    right: 10%;
    top: 40px;
    z-index: 1;
    font-size: .7em;
  }
}

              
            
!

JS

              
                // No JavaScript needed for the tooltip with data-element
              
            
!
999px

Console