Skip to content

Commit 8082c4d

Browse files
committed
updated docs for new way of handing supressed division
1 parent 905f749 commit 8082c4d

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

docs/docs.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,27 +136,41 @@ they are evaluated:
136136
margin: 10px - 5px;
137137
```
138138

139-
Division has a special quirk. Due to CSS font shorthand syntax, we need to be
140-
careful about how we place spaces. In the following example we are using font
141-
size and lineheight shorthand. No division should take place:
139+
Division has a special quirk. There are certain CSS properties that use the `/`
140+
operator as part of their value's syntax. Namely, the [font][4] shorthand and
141+
[border-radius][3].
142+
143+
[3]: https://developer.mozilla.org/en/CSS/border-radius
144+
[4]: https://developer.mozilla.org/en/CSS/font
145+
146+
147+
Thus, **lessphp** will ignore any division in these properties unless it is
148+
wrapped in parentheses. For example, no division will take place here:
142149

143150
```less
144151
.font {
145152
font: 20px/80px "Times New Roman";
146153
}
147154
```
148155

149-
In order to force division we can surround the `/` by spaces, or we can wrap
150-
the expression in parentheses:
156+
In order to force division we must wrap the expression in parentheses:
151157

152158
```less
153159
.font {
154-
// these two will evaluate
155-
font: 20px / 80px "Times New Roman";
156160
font: (20px/80px) "Times New Roman";
157161
}
158162
```
159163

164+
If you want to write a literal `/` expression without dividing in another
165+
property (or a variable), you can use [string unquoting](#string_unquoting):
166+
167+
```less
168+
.var {
169+
@size: ~"20px/80px"
170+
font: @size sans-serif;
171+
}
172+
```
173+
160174
### Nested Blocks
161175

162176
By nesting blocks we can build up a chain of CSS selectors through scope

0 commit comments

Comments
 (0)