site_demos.less 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // these are the demos from the lessphp homepage
  2. default {
  3. @base: 24px;
  4. @border-color: #B2B;
  5. .underline { border-bottom: 1px solid green }
  6. #header {
  7. color: black;
  8. border: 1px solid @border-color + #222222;
  9. .navigation {
  10. font-size: @base / 2;
  11. a {
  12. .underline;
  13. }
  14. }
  15. .logo {
  16. width: 300px;
  17. &:hover { text-decoration: none }
  18. }
  19. }
  20. }
  21. variables {
  22. @a: 2;
  23. @x: @a * @a;
  24. @y: @x + 1;
  25. @z: @x * 2 + @y;
  26. @nice-blue: #5B83AD;
  27. @light-blue: @nice-blue + #111;
  28. @b: @a * 10;
  29. @c: #888;
  30. @fonts: "Trebuchet MS", Verdana, sans-serif;
  31. .variables {
  32. width: @z + 1cm; // 14cm
  33. height: @b + @x + 0px; // 24px
  34. color: @c;
  35. background: @light-blue;
  36. font-family: @fonts;
  37. }
  38. }
  39. mixins {
  40. .bordered {
  41. border-top: dotted 1px black;
  42. border-bottom: solid 2px black;
  43. }
  44. #menu a {
  45. color: #111;
  46. .bordered;
  47. }
  48. .post a {
  49. color: red;
  50. .bordered;
  51. }
  52. }
  53. nested-rules {
  54. #header {
  55. color: black;
  56. .navigation {
  57. font-size: 12px;
  58. }
  59. .logo {
  60. width: 300px;
  61. &:hover { text-decoration: none }
  62. }
  63. }
  64. }
  65. namespaces {
  66. #bundle {
  67. .button {
  68. display: block;
  69. border: 1px solid black;
  70. background-color: grey;
  71. &:hover { background-color: white }
  72. }
  73. }
  74. #header a {
  75. color: orange;
  76. #bundle > .button; // mixin the button class
  77. }
  78. }
  79. mixin-functions {
  80. @outer: 10px;
  81. @class(@var:22px, @car: 400px + @outer) {
  82. margin: @var;
  83. height: @car;
  84. }
  85. @group {
  86. @f(@color) {
  87. color: @color;
  88. }
  89. .cool {
  90. border-bottom: 1px solid green;
  91. }
  92. }
  93. .class(@width:200px) {
  94. padding: @width;
  95. }
  96. body {
  97. .class(2.0em);
  98. @group > @f(red);
  99. @class(10px, 10px + 2);
  100. @group > .cool;
  101. }
  102. }