Skip to content

Instantly share code, notes, and snippets.

@nelsonenzo
Created April 29, 2011 02:40
Show Gist options
  • Save nelsonenzo/947744 to your computer and use it in GitHub Desktop.
Save nelsonenzo/947744 to your computer and use it in GitHub Desktop.
abCSS Framework Generator
styles = [
{:namespace => "mt", :attribute => "margin-top", :suffix => "px", :max => 500, :min => 0, :step => 1},
{:namespace => "mb", :attribute => "margin-bottom", :suffix => "px", :max => 500, :min => 0, :step => 1},
{:namespace => "ml", :attribute => "margin-left", :suffix => "px" , :max => 500, :min => 0, :step => 1},
{:namespace => "mr", :attribute => "margin-right", :suffix => "px" , :max => 500, :min => 0, :step => 1},
{:namespace => "w", :attribute => "width", :suffix => "px", :max => 1200, :min => 0, :step => 1},
{:namespace => "wp", :attribute => "width", :suffix => "%", :max => 100, :min => 0, :step => 1},
{:namespace => "h", :attribute => "height", :suffix => "px", :max => 500, :min => 0, :step => 1},
{:namespace => "fs", :attribute => "font-size", :suffix => "px", :max => 48, :min => 0, :step => 1},
{:namespace => "p", :attribute => "padding", :suffix =>"px", :max => 40, :min => 0, :step => 1},
{:namespace => "pt", :attribute => "padding-top", :suffix =>"px", :max => 40, :min => 0, :step => 1},
{:namespace => "pb", :attribute => "padding-bottom", :suffix =>"px", :max => 40, :min => 0, :step => 1},
{:namespace => "pl", :attribute => "padding-left", :suffix =>"px", :max => 40, :min => 0, :step => 1},
{:namespace => "pr", :attribute => "padding-right", :suffix =>"px", :max => 40, :min => 0, :step => 1}
]
f = File.new('enzo.css',"w+")
styles.each do |style|
style[:min].step(style[:max],style[:step] || 1) do |i|
#(style[:min]...style[:max]).each do |i|
f << '.' + style[:namespace] + i.to_s + '{' + style[:attribute] + ':' + i.to_s + style[:suffix] + ';' + '}'
end
end
f << ' .dilb { display:inline-block; }
.fl {float:left;}
.fr {float:right;}
.tac{text-align:center;}
.tar{text-align:right;}
/* Vertical Alignment*/
.vab { vertical-align:bottom;}
.vam { vertical-align:middle;}
.vat { vertical-align:top;}
/* borders */
.bb1 { border-bottom-style:solid; border-bottom-width:1px; }
.bb2 { border-bottom-style:solid; border-bottom-width:2px; }
.bb3 { border-bottom-style:solid; border-bottom-width:3px; }
.bt1 { border-top-style:solid; border-top-width:1px; }
.bt2 { border-top-style:solid; border-top-width:2px; }
.bt3 { border-top-style:solid; border-top-width:3px; }
/* display */
.db {display:block;}
.dilb { display:inline-block;}
/* font styling */
.fcw {color:white;}
.fsi {font-style:italic;}
.fwb {font-weight:bold;}
/* list formatting - Horizontal*/
ul.h li{
display: inline-block;
list-style-type: none;
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment