1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-20 13:31:43 +02:00

Updating function instructions.

This commit is contained in:
Sean Corrales
2015-10-08 15:37:54 -05:00
parent 1bc4577375
commit 25d5d07dd3

View File

@@ -188,7 +188,8 @@ body.noLinks a {
#################### */ #################### */
/* Sass provides functions that can be used to accomplish a variety of tasks. Consider the following */ /* Sass provides functions that can be used to accomplish a variety of tasks. Consider the following */
/* Functions can be invoked by using their name and passing in the required arguments */
body { body {
width: round(10.25px); width: round(10.25px);
} }
@@ -207,19 +208,19 @@ body {
background-color: rgba(0, 0, 0, 0.75); background-color: rgba(0, 0, 0, 0.75);
} }
/* You may also define your own functions. Functions are very similar to mixins. When trying to choose between /* You may also define your own functions. Functions are very similar to mixins. When trying
a function or a mixin, remember that functions are best for returning values while mixins are best for to choose between a function or a mixin, remember that functions are best for returning
generating CSS while functions are better for logic that might be used throughout your Sass code. The values while mixins are best for generating CSS while functions are better for logic that
examples in the Math Operators' section are ideal candidates for becoming a reusable function. */ might be used throughout your Sass code. The examples in the Math Operators' section are
ideal candidates for becoming a reusable function. */
/* This function will take a target size and the parent size and calculate and return the percentage */ /* This function will take a target size and the parent size and calculate and return
the percentage */
@function calculate-percentage($target-size, $parent-size) { @function calculate-percentage($target-size, $parent-size) {
@return $target-size / $parent-size * 100%; @return $target-size / $parent-size * 100%;
} }
/* Functions can be invoked by using their name and passing in the required arguments */
$main-content: calculate-percentage(600px, 960px); $main-content: calculate-percentage(600px, 960px);
.main-content { .main-content {