grid.styl 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /////////////////
  2. // Semantic.gs // for Stylus: http://learnboost.github.com/stylus/
  3. /////////////////
  4. // Utility function — you should never need to modify this
  5. // _gridsystem-width = (column-width + gutter-width) * columns
  6. gridsystem-width(_columns = columns)
  7. (column-width + gutter-width) * _columns
  8. // Set @total-width to 100% for a fluid layout
  9. // total-width = gridsystem-width(columns)
  10. total-width = 100%
  11. //////////
  12. // GRID //
  13. //////////
  14. body
  15. clearfix()
  16. width: 100%
  17. row(_columns = columns)
  18. clearfix()
  19. display: block
  20. width: total-width * ((gutter-width + gridsystem-width(_columns)) / gridsystem-width(_columns))
  21. margin: 0 total-width * (((gutter-width * .5) / gridsystem-width(_columns)) * -1)
  22. column(x, _columns = columns)
  23. display: inline
  24. float: left
  25. width: total-width * ((((gutter-width + column-width) * x) - gutter-width) / gridsystem-width(_columns))
  26. margin: 0 total-width * ((gutter-width * .5) / gridsystem-width(_columns))
  27. push(offset = 1)
  28. margin-left: total-width * (((gutter-width + column-width) * offset) / gridsystem-width(columns))
  29. pull(offset = 1)
  30. margin-right: total-width * (((gutter-width + column-width) * offset) / gridsystem-width(columns))