The Heads-Up Grid is an overlay grid for in-browser website development, built with HTML + CSS + JavaScript.
If you haven’t already defined a grid, use The Gridulator. Then download The Heads-Up Grid files and paste the following code into the <head> element of your webpage:
<link href="headsupgrid/hugrid.css" type="text/css" rel="stylesheet" /> <script src="headsupgrid/jquery-1.6.2.min.js"></script> <script src="headsupgrid/hugrid.js"></script> <script type="text/javascript"> $(document).ready(function() { pageUnits = 'px'; colUnits = 'px'; pagewidth = 960; columns = 6; columnwidth = 140; gutterwidth = 24; pagetopmargin = 35; rowheight = 20; gridonload = 'off'; makehugrid(); setgridonload(); }); </script>
You probably noticed by looking at that text that the default grid has the following properties:
Alter the numbers to create your desired grid. If you don’t need the baseline grid, set the row height to 0. The default unit of measure is pixels.
You are now ready to get back to the real work: meticulously lining up images and text!
Responsive web design, as described/defined by Ethan Marcotte anyway, is the act of creating various forms of the same basic site design that are optimized for different ranges of browser window widths.
Luckily, the way that I originally constructed the Heads-Up Grid made it relatively easy to adapt to the needs of responsive web design. You can quickly and easily define as many different grids as you need by way of basic JavaScript conditional statements. Even if you are not extremely comfortable with JavaScript, if you are ambitious enough to tackle responsive web design you will most likely have no problem figuring this out.
To create a responsive grid use the following code as a template. This template is fairly self-explanatory if you are familiar with CSS Media Queries. These JavaScript conditional properties should directly match the properties you are using for your media queries. Then simply define the properties of multiple grids in the same way you would define a single grid above.
The result should be a system that checks the browser window width on pageload as well as any time that the browser window is resized and render the appropriate grid.
<link href="headsupgrid/hugrid.css" type="text/css" rel="stylesheet" /> <script src="headsupgrid/jquery-1.6.2.min.js"></script> <script src="headsupgrid/hugrid.js"></script> <script type="text/javascript"> definegrid = function() { var browserWidth = $(window).width(); if (browserWidth >= 1001) { pageUnits = 'px'; colUnits = 'px'; pagewidth = 960; columns = 6; columnwidth = 140; gutterwidth = 24; pagetopmargin = 35; rowheight = 20; gridonload = 'off'; makehugrid(); } if (browserWidth <= 1000) { pageUnits = '%'; colUnits = '%'; pagewidth = 94; columns = 2; columnwidth = 48; gutterwidth = 4; pagetopmargin = 35; rowheight = 20; gridonload = 'off'; makehugrid(); } if (browserWidth <= 768) { pageUnits = '%'; colUnits = '%'; pagewidth = 96; columns = 2; columnwidth = 49; gutterwidth = 2; pagetopmargin = 35; rowheight = 20; gridonload = 'off'; makehugrid(); } } $(document).ready(function() { definegrid(); setgridonload(); }); $(window).resize(function() { definegrid(); setgridonresize(); }); </script>
Below is a complete list of properties available in the Heads-Up Grid system.
property name | values |
---|---|
pageUnits | px, % |
colUnits | px, % |
gridonload | on, off |
pagewidth | [number in pageUnits] |
columns | [number of columns] |
columnwidth | [number in colUnits] |
gutterwidth | [number in colUnits] |
pagetopmargin | [number in pixels] |
rowheight | [number in pixels] |
pageleftmargin | [number in pageUnits] |
pagerightmargin | [number in pageUnits] |
default value in bold
non-numerical property values must be defined within quotes: gridonload = 'off';
You can now contribute to this project by way of GitHub. I’m still learning about version control, but hopefully this will make it easier to improve and cotnribute to this project!
Nothing is ever finished. The Heads-Up Grid has been improved since its introduction. Below is a description of how it has been changed over time.