positions.styl 955 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // helper
  2. -pos(type, args)
  3. i = 0
  4. position: unquote(type)
  5. for j in (1..4)
  6. if length(args) > i
  7. {args[i]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
  8. i += 1
  9. /*
  10. * Position utility.
  11. *
  12. * Synopsis:
  13. *
  14. * fixed: <pos> [n] <pos> [n]
  15. *
  16. * Examples:
  17. *
  18. * fixed: top left
  19. * fixed: top 5px left
  20. * fixed: top left 5px
  21. * fixed: top 5px left 5px
  22. *
  23. */
  24. fixed()
  25. -pos('fixed', arguments)
  26. /*
  27. * Position utility.
  28. *
  29. * Synopsis:
  30. *
  31. * absolute: <pos> [n] <pos> [n]
  32. *
  33. * Examples:
  34. *
  35. * absolute: top left
  36. * absolute: top 5px left
  37. * absolute: top left 5px
  38. * absolute: top 5px left 5px
  39. *
  40. */
  41. absolute()
  42. -pos('absolute', arguments)
  43. /*
  44. * Position utility.
  45. *
  46. * Synopsis:
  47. *
  48. * relative: <pos> [n] <pos> [n]
  49. *
  50. * Examples:
  51. *
  52. * relative: top left
  53. * relative: top 5px left
  54. * relative: top left 5px
  55. * relative: top 5px left 5px
  56. *
  57. */
  58. relative()
  59. -pos('relative', arguments)