Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
  div {
    display: table; 
  }
  a {
    display: table-cell;
    vertical-align: middle;
  margin: 10px;
  width: 200px;
  padding-left: 34px;
  font-size: 14px;  
  
  background: url('http://cdn1.iconfinder.com/data/icons/freeapplication/png/24x24/Thumbs%20up.png');  
  background-repeat: no-repeat;
  background-position: 0 0;
  border: 1px solid black;
}
</style>
</head>
<body>
  <div>
<a id="example-a">background-position: center</a>
  </div>
</body>
</html>
 
$(function() {
    var imageSrc = $('#example-a')
                     .css('background-image')
                       .replace('url(', '')
                          .replace(')', '')
                          .replace("'", '')
                          .replace('"', '');   
  var image = '<img style="display: none;" src="' + imageSrc + ' />';
  $('div').append(image);
    var width = $('img').width(),
        height = $('img').height(); 
  
  $('#example-a').height(height);
});
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers