Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
 <!DOCTYPE html>
<html>
<head>
  <meta charset=utf-8 />
  <title>JS Bin</title>
  <style type="text/css">
    body {
      font-family: helvetica, sans-serif;
      font-size: 10px;
    }
    .sprite {
      background: url(http://vxresource.files.wordpress.com/2010/02/char113.png);
      height: 32px;
      width: 30px;
      background-position: 128px 0px;
      position: relative;
      top: 50px;
      left: 50px;
    }
    .sprite::after {
      content: attr(data-score);
      position: absolute;
      top: -10px;
      opacity:0;
      transition: 2s;
    }
    .sprite:hover::after {
      opacity: 1;
    }
    .sprite[data-score='10']::after {
      color: #c00;
    }
  </style>
  </head>
<body>
  <div class="sprite" data-score="100"></div>
  <script>
    var character = document.querySelector('.sprite');
    character.dataset.score = 10;
  </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers