Monday.
scss functions
Arithmatic and color
color function
for loops
each loops
conditionals
Mixins should only be used if they take in an argument, otherwise, you should extend the selector's rules, whether it be a class, id, or placeholder.
color function
color: red + blue;
Arithmatic
The Sass arithmetic operations are:
- addition
+
- subtraction
-
- multiplication
*
- division
/
, and - modulo
%
.
- If the value, or any part of it, is stored in a variable or returned by a function.
- If the value is surrounded by parentheses, unless those parentheses are outside a list and the value is inside.
- If the value is used as part of another arithmetic expression.
Each loop
Each loops in Sass iterate on each of the values on a list. The syntax is as follows:
@each $item in $list {
//some rules and or conditions
}
The value of $item
is dynamically assigned to the value of the object in the list according to its position and the iteration of the loop.For loop
@for $i from $begin through $end {
//some rules and or conditions
}
In the example above:$i
is just a variable for the index, or position of the element in the list$begin
and$end
are placeholders for the start and end points of the loop.- The keywords
through
andto
are interchangeable in Sass
No comments:
Post a Comment