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>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  #box{height:300px;width:100px;outline:2px dotted blue}
  #status{height:2em}
</style>
</head>
<body>
  <div id="status"></div>
  <div id="box"></div>
</body>
</html>
 
// getComputedStyle wrapper
function getStyle(element, styleProp) {
  return element.currentStyle ? element.currentStyle[styleProp] :
      getComputedStyle(element, null).getPropertyValue(styleProp);
}
// cheesy convenience function
function textDiv(textContent, className) {
  var tmp = document.createElement('div');
  if (className) tmp.className = className;
  tmp.appendChild(document.createTextNode(textContent));
  return tmp;
}
var box = document.getElementById('box'),
    glyph = box.appendChild(textDiv('g', 'glyph')),
    size=500;
  glyph.style.position = 'absolute';
  document.getElementById('status').appendChild(
  textDiv('Initial computed width: ' + getStyle(glyph, 'width'))
);
while (parseInt(getStyle(glyph, 'width'), 10) <  100) {
  glyph.style.fontSize = size++ + '%';
}
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers