Return to Snippet

Revision: 17521
at September 8, 2009 10:24 by brettbergeron


Initial Code
<?php	

	header("Content-type: text/css");
	
	$columns = 4;
	$column_size = 215;
	$column_gutter = 20;
	$rule = array('border-top' => '2px solid black', 'margin-top' => '10px');
	
	$sizes = array('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen');
	
	for($n = 1; $n <= $columns; $n++)
	{
		echo $sizes[$n - 1] ." { ";
		
		echo "width: " . ($column_size * $n + $column_gutter * ($n - 1) ) . "px; ";
		
		foreach($rule as $property => $value):
		
				echo "$property: $value; ";
			
		endforeach;
		
		echo "} \n";
	}
	
	
	
/* End of file grid.php */

Initial URL
http://brettbergeron.com

Initial Description
Code explains itself. I plan to do a lot more work on it - just wanted to throw it up here for a little sharing. Feel free to take it to the next level.

Initial Title
CSS Grid Generator

Initial Tags
css, php

Initial Language
PHP