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.

            
              <h1>Using the css data-attribute function<small><br>for a sexy CSS hover On this cool button</small></h1>

<p>Great to use for lightweight tooltips</p>

<button data-hover="this is the data-hover content">hover me</button>


            
          
!
            
              @btn-color: #DB701F;
html {
  font-family: Georgia, serif;
  color: #888;
}
body {
  padding: 5em 2em;
  text-align: center;
  background: #f3f3f3;
}
button {
  background: @btn-color;
  border: solid 7px #000;
  padding: 20px;
  box-shadow: inset 0 0 6px darken(@btn-color,20%);
  text-transform: uppercase;
  font-weight: bold;
  font-family: "Tahoma", sans-serif;
  text-shadow: 1px 1px 3px darken(@btn-color,20%);
  color: #fff;
  position: relative;
  width: 300px;
  &:hover {
    background: green;
    &:before {
      /* ------- THIS IS THE MAGIC ----------------*/
      content: attr(data-hover);
      /* ------------------------------------------*/
      display: block;
      background: #000;
      position: absolute;
      top: 100%;
      left: -7px;
      right: -7px;
      padding: 15px; 
    }
    &:after {
      content: "";
      position: absolute;
      display: block;
      width: 0;
      height: 0;
      border: solid 10px transparent;
      border-bottom-color: #000;
      bottom: 0;
      left: 50%;
      margin-left: -10px;
      z-index: 2;
    }
  }
  
}

.note {
  margin-top: 100px;
  display: block;
}
            
          
!
999px
Loading ..................

Console