Skip to content

Instantly share code, notes, and snippets.

@poying
Created February 1, 2014 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poying/8751316 to your computer and use it in GitHub Desktop.
Save poying/8751316 to your computer and use it in GitHub Desktop.
golden-ratio-value = 1.618
golden-ratio(value)
value * golden-ratio-value
golden-ratio-font(fontSize, contentWidth, args...)
font-size: fontSize
golden-ratio-line-height: fontSize contentWidth
if length(args) > 0
golden-ratio-margin(fontSize, args[0], args[1], args[2], args[3])
golden-ratio-line-height(fontSize, contentWidth)
line-height: (fontSize * ceil(golden-ratio-value - (1 / (2 * golden-ratio-value)) * (1 - (contentWidth / ((fontSize * golden-ratio-value) * (fontSize * golden-ratio-value))))) * 1px)
golden-ratio-margin(fontSize, args...)
for value, i in args
if value
args[i] = _golden-ratio-margin(fontSize, value)
margin: args
_golden-ratio-margin(fontSize, baseValue = 24px)
baseValue / fontSize * 1px
golden-ratio-width(height)
width: height * golden-ratio-value
golden-ratio-height(width)
width: width / golden-ratio-value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment