Skip to content

Instantly share code, notes, and snippets.

@msweeney
Created August 4, 2010 07:22
Show Gist options
  • Save msweeney/507787 to your computer and use it in GitHub Desktop.
Save msweeney/507787 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>YUI Base Page</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css" type="text/css">
<style>
.yui-u {
height: 100%; /* snap to height of grid */
}
.module {
background: #ccc;
border: 1px solid #999;
height: 99%; /* adjust to accomodate border + padding */
}
</style>
</head>
<body>
<div id="doc2" class="yui-t7">
<div class="yui-gb">
<div class="yui-u first">
<div class="module">
<h2>Header</h2>
<p>lorem ipsum dolor sit.</p>
<p>lorem ipsum dolor sit.</p>
</div>
</div>
<div class="yui-u">
<div class="module">
<h2>Header</h2>
<p>lorem ipsum dolor sit.</p>
<p>lorem ipsum dolor sit.</p>
<p>lorem ipsum dolor sit.</p>
</div>
</div>
<div class="yui-u">
<div class="module">
<h2>Header</h2>
<p>lorem ipsum dolor sit.</p>
</div>
</div>
</div>
</div>
<script src="http://yui.yahooapis.com/2.8.1/build/yahoo/yahoo-min.js"></script>
<script src="http://yui.yahooapis.com/2.8.1/build/selector/selector-min.js"></script>
<script>
var nodes = YAHOO.util.Selector.query('div[class^=yui-g]'); // find class starts with
for (var i = 0, len = nodes.length; i < len; i++) {
nodes[i].style.height = nodes[i].offsetHeight + 'px'; // fix height to auto height
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment