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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <!-- Instead of using the 'title' attribute, simply use 'data-info' -->

<h1>Info on Hover!</h1>

<h2>Prettifying the 'title' attribute without Javascript!</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. <dfn data-info="Lorem ipsum dolor sit amet, perspiciatis consectetur dolor.">Perspiciatis consectetur</dfn> Et delectus ut neque quod porro maiores est. Asperiores aspernatur rerum, explicabo ipsa consequatur, accusantium <dfn data-info="Lorem ipsum dolor sit amet.">provident optio</dfn> officia maxime libero sint esse.</p>

<p>Lorem ipsum dolor sit amet, perspiciatis consectetur adipisicing elit. Dolor perspiciatis deserunt adipisci rem deserunt iste nulla tenetur. <dfn data-info="Lorem ipsum dolor sit amet, perspiciatis consectetur dolor.">Iste aliquid perspiciatis</dfn> dolorem laborum, nulla fugit accusamus possimus id tenetur officiis, impedit necessitatibus illo!</p>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Open+Sans:700,400,300);

::-moz-selection { background: rgba(0,0,0,0.2); }
::selection { background: rgba(0,0,0,0.2); }

/**** Skip to line 36 for the hover code ****/

body {
  background: linear-gradient(to right,#07a, #0aa);
  background-size: 100%;
  font-family: 'Open Sans', sans-serif;
  font-size: 16px;
  line-height: 1.5em;
  margin: 80px 4em 0;
  color: #f5f5f5;
}
h1 {
  max-width: 49rem;
  font-size: 3.5em;
  line-height: 1em;
  font-weight: 700;
  margin: 0.25em auto;
}
h2 {
  max-width: 49rem;
  margin: 1.4em auto;
}
p {
  line-height: 1.5em;
  margin: 1.4em auto;
  max-width: 49rem;
  font-size: 1em;
  font-weight: 300;
}

/** Code for hover info **/

dfn {
  background: rgba(0,0,0,0.2);
  border-bottom: dashed 1px rgba(0,0,0,0.8);
  padding: 0 0.4em;
  cursor: help;
  font-style: normal;
  position: relative;
  
}
dfn::after {
  content: attr(data-info);
  display: inline;
  position: absolute;
  top: 22px; left: 0;
  opacity: 0;
  width: 230px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5em;
  padding: 0.5em 0.8em;
  background: rgba(0,0,0,0.8);
  color: #fff;
  pointer-events: none; /* This prevents the box from apearing when hovered. */
  transition: opacity 250ms, top 250ms;
}
dfn::before {
  content: '';
  display: block;
  position: absolute;
  top: 12px; left: 20px;
  opacity: 0;
  width: 0; height: 0;
  border: solid transparent 5px;
  border-bottom-color: rgba(0,0,0,0.8);
  transition: opacity 250ms, top 250ms;
}
dfn:hover {z-index: 2;} /* Keeps the info boxes on top of other elements */
dfn:hover::after,
dfn:hover::before {opacity: 1;}
dfn:hover::after {top: 30px;}
dfn:hover::before {top: 20px;}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console