1
0

less.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <!doctype html>
  2. <title>CodeMirror: LESS mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <script src="../../lib/codemirror.js"></script>
  7. <script src="../../addon/edit/matchbrackets.js"></script>
  8. <script src="css.js"></script>
  9. <style>.CodeMirror {border: 1px solid #ddd; line-height: 1.2;}</style>
  10. <div id=nav>
  11. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  12. <ul>
  13. <li><a href="../../index.html">Home</a>
  14. <li><a href="../../doc/manual.html">Manual</a>
  15. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  16. </ul>
  17. <ul>
  18. <li><a href="../index.html">Language modes</a>
  19. <li><a class=active href="#">LESS</a>
  20. </ul>
  21. </div>
  22. <article>
  23. <h2>LESS mode</h2>
  24. <form><textarea id="code" name="code">@media screen and (device-aspect-ratio: 16/9) { … }
  25. @media screen and (device-aspect-ratio: 1280/720) { … }
  26. @media screen and (device-aspect-ratio: 2560/1440) { … }
  27. html:lang(fr-be)
  28. tr:nth-child(2n+1) /* represents every odd row of an HTML table */
  29. img:nth-of-type(2n+1) { float: right; }
  30. img:nth-of-type(2n) { float: left; }
  31. body > h2:not(:first-of-type):not(:last-of-type)
  32. html|*:not(:link):not(:visited)
  33. *|*:not(:hover)
  34. p::first-line { text-transform: uppercase }
  35. @namespace foo url(http://www.example.com);
  36. foo|h1 { color: blue } /* first rule */
  37. span[hello="Ocean"][goodbye="Land"]
  38. E[foo]{
  39. padding:65px;
  40. }
  41. input[type="search"]::-webkit-search-decoration,
  42. input[type="search"]::-webkit-search-cancel-button {
  43. -webkit-appearance: none; // Inner-padding issues in Chrome OSX, Safari 5
  44. }
  45. button::-moz-focus-inner,
  46. input::-moz-focus-inner { // Inner padding and border oddities in FF3/4
  47. padding: 0;
  48. border: 0;
  49. }
  50. .btn {
  51. // reset here as of 2.0.3 due to Recess property order
  52. border-color: #ccc;
  53. border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);
  54. }
  55. fieldset span button, fieldset span input[type="file"] {
  56. font-size:12px;
  57. font-family:Arial, Helvetica, sans-serif;
  58. }
  59. .rounded-corners (@radius: 5px) {
  60. border-radius: @radius;
  61. -webkit-border-radius: @radius;
  62. -moz-border-radius: @radius;
  63. }
  64. @import url("something.css");
  65. @light-blue: hsl(190, 50%, 65%);
  66. #menu {
  67. position: absolute;
  68. width: 100%;
  69. z-index: 3;
  70. clear: both;
  71. display: block;
  72. background-color: @blue;
  73. height: 42px;
  74. border-top: 2px solid lighten(@alpha-blue, 20%);
  75. border-bottom: 2px solid darken(@alpha-blue, 25%);
  76. .box-shadow(0, 1px, 8px, 0.6);
  77. -moz-box-shadow: 0 0 0 #000; // Because firefox sucks.
  78. &.docked {
  79. background-color: hsla(210, 60%, 40%, 0.4);
  80. }
  81. &:hover {
  82. background-color: @blue;
  83. }
  84. #dropdown {
  85. margin: 0 0 0 117px;
  86. padding: 0;
  87. padding-top: 5px;
  88. display: none;
  89. width: 190px;
  90. border-top: 2px solid @medium;
  91. color: @highlight;
  92. border: 2px solid darken(@medium, 25%);
  93. border-left-color: darken(@medium, 15%);
  94. border-right-color: darken(@medium, 15%);
  95. border-top-width: 0;
  96. background-color: darken(@medium, 10%);
  97. ul {
  98. padding: 0px;
  99. }
  100. li {
  101. font-size: 14px;
  102. display: block;
  103. text-align: left;
  104. padding: 0;
  105. border: 0;
  106. a {
  107. display: block;
  108. padding: 0px 15px;
  109. text-decoration: none;
  110. color: white;
  111. &:hover {
  112. background-color: darken(@medium, 15%);
  113. text-decoration: none;
  114. }
  115. }
  116. }
  117. .border-radius(5px, bottom);
  118. .box-shadow(0, 6px, 8px, 0.5);
  119. }
  120. }
  121. </textarea></form>
  122. <script>
  123. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  124. lineNumbers : true,
  125. matchBrackets : true,
  126. mode: "text/x-less"
  127. });
  128. </script>
  129. <p>The LESS mode is a sub-mode of the <a href="index.html">CSS mode</a> (defined in <code>css.js</code>.</p>
  130. <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#less_*">normal</a>, <a href="../../test/index.html#verbose,less_*">verbose</a>.</p>
  131. </article>