The CSS selectors are pattern-matching rules that determine which style rules apply to the elements in the document tree. As can be read in the Referencing parent selectors with the & operator recipe, the &
operator can be used inside nested rules in Less. Placing the &
parent reference at the end of a selector inside a nested rule gives you the opportunity to change the selecting order.
For client-side compiling, you will have to create an index.html
file that will load the example.less
file and the less.js
compiler with the following code in the head
section:
<link rel="stylesheet/less" type="text/css" href="less/example.less"> <script src="js/less.js" type="text/javascript"></script>