|
91 | 91 | {% endhighlight %}
|
92 | 92 |
|
93 | 93 | In the previous example, we're asking GSS to give the `#GSS` and `#cassowary` elements a width of 200px and we
|
94 |
| -later ask cassowary to constraint the sum of these two element to be equal to 350px. In this case, one the the |
| 94 | +later declare a constraint for the sum of these two elements to be equal to 350px. In this case, one of these |
95 | 95 | two constraints will not hold. As we'll see later in the documentation you can influence the constraints solving
|
96 | 96 | by given more intent to GSS about what you want. <a href="http://codepen.io/cbchouinard/pen/XJROdV" target="_blank">Live example.</a>
|
97 | 97 |
|
|
119 | 119 | - `!strong`
|
120 | 120 | - `!require`
|
121 | 121 |
|
122 |
| -`!medium` is the default for all constraints when no strenght is explicitly |
| 122 | +`!medium` is the default for all constraints when no strenght is explicitly defined. |
123 | 123 |
|
124 |
| -#### Strenghts example |
125 |
| -Using the [May or may not hold example](#mayofmaynothold) we saw previously, in this example will give |
126 |
| -more strenght to the `#GSS` and `#cassowary` elements to make sure they overcome the sum |
127 |
| -constraints. <a href="http://codepen.io/cbchouinard/pen/bNRbQg" target="_blank">Live example.</a> |
| 124 | +Using the [May or may not hold example](#mayofmaynothold) example we saw previously, |
| 125 | +we'll give in the following example more strenghts to the each individual `width` to |
| 126 | +make sure they overcome the sum constraints: <a href="http://codepen.io/cbchouinard/pen/bNRbQg" target="_blank">Live example.</a> |
128 | 127 |
|
129 | 128 |
|
130 | 129 | #### !require strenght
|
|
154 | 153 |
|
155 | 154 | ### Constraints order
|
156 | 155 | Generally speaking, later constraint statements are more powerful than earlier ones. There could be exception
|
157 |
| -to this behavior as well see in the following sections when using conditions. |
| 156 | +to this behavior as well see in the following sections. |
158 | 157 |
|
159 | 158 | Taking the [May or may not hold example](#mayofmaynothold) we saw previously, by changing the order you'll get a
|
160 | 159 | different result. <a href="http://codepen.io/cbchouinard/pen/rawBRr" target="_blank">Live example.</a>
|
|
173 | 172 |
|
174 | 173 | {% endhighlight %}
|
175 | 174 |
|
176 |
| -Will the `#box` move or stretch to satisfy the last constraint? Again, the later constraint statements are more powerful than later ones, so the box's width would stretch. You can control this by either changing the order in which the constraints are declared or by using a `stay` like so: |
| 175 | +Will the `#box` move or stretch to satisfy the last constraint? Again, the later constraint statements are more |
| 176 | +powerful than later ones, so the box's width would stretch. You can control this by either changing the order in |
| 177 | +which the constraints are declared or by using a `stay` like so: |
177 | 178 |
|
178 | 179 | {% highlight css %}
|
179 |
| -#box[left] >= 100; |
| 180 | + |
| 181 | +#box[right] == ::window[right]; |
180 | 182 | #box[width] >= 100;
|
| 183 | +#box[left] >= 100; |
181 | 184 | @stay(#box[width]);
|
182 |
| -#box[right] == ::window[right]; |
183 | 185 |
|
184 | 186 | /* the #box's position will move */
|
185 | 187 | {% endhighlight %}
|
|
205 | 207 | I wish we could go non-linear, but we can't because math.
|
206 | 208 |
|
207 | 209 | ## Units of measurement
|
208 |
| -Default unit in GSS are pixels. When omiting the unit, pixels will be use. GSS also supports the following units: |
| 210 | +Default unit in GSS are pixels. GSS also supports the following units: |
209 | 211 |
|
210 | 212 | {% highlight css %}
|
211 |
| -#pixel[width] == 100px; |
212 | 213 | #em[width] == 10em;
|
213 | 214 | #pourcentage[width] == 10%;
|
214 | 215 | {% endhighlight %}
|
|
647 | 648 | ## Intrinsic values
|
648 | 649 |
|
649 | 650 | When you want to constraint the position of an element GSS needs to know the dimension of the element. For example how could
|
650 |
| -GSS position an element using the bottom-right property without knowing the height and width of the element. |
| 651 | +GSS position an element using the bottom-right property without knowing the height and width of that element. |
651 | 652 |
|
652 |
| -One way to solve this, would be to constraint the dimension of the element. But what if it had text in it and what if that text was dynamic? |
| 653 | +One way to solve this, would be to constraint the dimension of the element. But what if it had text in it? You'll then need to know the |
| 654 | +exact width and height require to display the text. What if that text is dynamic? |
653 | 655 |
|
654 |
| -GSS provides the `intrinsic-` properties to get the dimension of the element defined by the text occupying the element and/or the CSS styling the element. |
| 656 | +GSS provides the `intrinsic-` properties to get the dimension of the element defined by the text occupying the element and/or the |
| 657 | +CSS styling the element. |
655 | 658 |
|
656 | 659 | {% highlight css %}
|
657 | 660 |
|
|
668 | 671 |
|
669 | 672 | Once an intrinsic value is constrained on a property, GSS will not evaluate other constraints you define on the same property.
|
670 | 673 |
|
671 |
| -For example if we add a `width` constraint on `.SelectorA` this constraint will be ignored by GSS since `intrinsic-` have total |
| 674 | +For example if we add a `width` constraint on `.SelectorA` this constraint will be ignored by GSS since `intrinsic-*` have total |
672 | 675 | precendence over all other constraints.
|
673 | 676 |
|
674 | 677 | ## Virtuals
|
675 |
| -Virtuals are a very cool concept that allows you to constraints elements on virtual element that don't actually exists in the DOM. |
| 678 | +Virtuals are a very interesting concept that allows you to constraints elements against `virtual` element that don't actually exists in the DOM. |
676 | 679 |
|
677 | 680 |
|
678 | 681 | {% highlight css %}
|
|
687 | 690 |
|
688 | 691 | {% endhighlight %}
|
689 | 692 |
|
690 |
| -In this example we are constraining `#elmA` and `#elmB` against the virtual element. TODO - Live example |
| 693 | +In this example we are constraining `#elmA` and `#elmB` against the virtual element. |
691 | 694 |
|
692 | 695 | Virtuals are very handy with [VFL](/guides/vfl-guide).
|
0 commit comments