Skip to content

Instantly share code, notes, and snippets.

@ChrisMissal
Created December 12, 2009 04:56
Show Gist options
  • Save ChrisMissal/3211f8d90f1887015d67 to your computer and use it in GitHub Desktop.
Save ChrisMissal/3211f8d90f1887015d67 to your computer and use it in GitHub Desktop.
IE8 gives an error, FF 3.5.5 does not
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<style type="text/css">
dt { display: block; float: left; border-right: 1px solid red; }
</style>
</head>
<body>
<h1>test</h1>
<dl>
<dt>something awesome</dt><dd>1</dd>
<dt>another</dt><dd>2</dd>
</dl>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var g = $("dl");
scaleGraph(g);
});
function scaleGraph(graph) {
var maxWidth = 0;
graph.children("dt").each(function() {
var width = $(this).css("width").replace(/px/,'');
maxWidth = Math.max(width, maxWidth);
}).css({width: maxWidth+"px"});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment