let
y const
. En Sass, las variables comienzan con $
seguido del nombre de la variable. Aqui hay un par de ejemplos: $ main-fonts: Arial, sans-serif;Un ejemplo en el que las variables son útiles es cuando varios elementos deben ser del mismo color. Si se cambia ese color, el único lugar para editar el código es el valor variable.
$ encabezados-color: verde;
// Para utilizar variables:
h1 {
familia de fuentes: $ main-fonts;
color: $ encabezados-color;
}
$text-color
y configúrala en rojo. Luego cambie el valor de la propiedad de color
para .blog-post
y h2
a la variable $text-color
. $text-color
con un valor de rojo.
testString: 'assert(code.match(/\$text-color:\s*?red;/g), "Your code should have a Sass variable declared for $text-color
with a value of red.");'
- text: Su código debe usar la variable $text-color
para cambiar el color
de los elementos .blog-post
y h2
.
testString: 'assert(code.match(/color:\s*?\$text-color;/g), "Your code should use the $text-color
variable to change the color
for the .blog-post
and h2
items.");'
- text: Tu elemento .blog-post
debe tener un color rojo.
testString: 'assert($(".blog-post").css("color") == "rgb(255, 0, 0)", "Your .blog-post
element should have a color of red.");'
- text: Tus elementos h2
deben tener un color rojo.
testString: 'assert($("h2").css("color") == "rgb(255, 0, 0)", "Your h2
elements should have a color of red.");'
```
This is a paragraph with some random text in it
Here is some more random text.
Even more random text within a paragraph