mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
[sass/en] Cleaning up wording and formatting
This commit is contained in:
parent
7119a37a4e
commit
eb5d2d6261
@ -4,27 +4,28 @@ filename: learnsass.scss
|
||||
contributors:
|
||||
- ["Laura Kyle", "https://github.com/LauraNK"]
|
||||
- ["Sean Corrales", "https://github.com/droidenator"]
|
||||
- ["Kyle Mendes", "https://github.com/pink401k"]
|
||||
---
|
||||
|
||||
Sass is a CSS extension language that adds features such as variables, nesting, mixins and more.
|
||||
Sass (and other preprocessors, such as [Less](http://lesscss.org/)) help developers to write maintainable and DRY (Don't Repeat Yourself) code.
|
||||
Sass (and other preprocessors, such as [Less](http://lesscss.org/)) help developers write maintainable and DRY (Don't Repeat Yourself) code.
|
||||
|
||||
Sass has two different syntax options to choose from. SCSS, which has the same syntax as CSS but with the added features of Sass. Or Sass (the original syntax), which uses indentation rather than curly braces and semicolons.
|
||||
This tutorial is written using SCSS.
|
||||
|
||||
If you're already familiar with CSS3, you'll be able to pick up Sass relatively quickly. It does not provide any new styling options but rather the tools to write your CSS more efficiently and make maintenance much easier.
|
||||
If you're already familiar with CSS3, you'll be able to pick up Sass relatively quickly. It does not provide any new styling properties but rather the tools to write your CSS more efficiently and make maintenance much easier.
|
||||
|
||||
```scss
|
||||
|
||||
|
||||
//Single line comments are removed when Sass is compiled to CSS.
|
||||
|
||||
/*Multi line comments are preserved. */
|
||||
/* Multi line comments are preserved. */
|
||||
|
||||
|
||||
|
||||
/*Variables
|
||||
==============================*/
|
||||
/* Variables
|
||||
============================== */
|
||||
|
||||
|
||||
|
||||
@ -36,7 +37,7 @@ $secondary-color: #51527F;
|
||||
$body-font: 'Roboto', sans-serif;
|
||||
|
||||
/* You can use the variables throughout your stylesheet.
|
||||
Now if you want to change a color, you only have to make the change once.*/
|
||||
Now if you want to change a color, you only have to make the change once. */
|
||||
|
||||
body {
|
||||
background-color: $primary-color;
|
||||
@ -57,15 +58,15 @@ each time it appears throughout your stylesheet. */
|
||||
|
||||
|
||||
|
||||
/*Mixins
|
||||
==============================*/
|
||||
/* Mixins
|
||||
============================== */
|
||||
|
||||
|
||||
|
||||
/* If you find you are writing the same code for more than one
|
||||
element, you might want to store that code in a mixin.
|
||||
|
||||
Use the '@mixin' directive, plus a name for your mixin.*/
|
||||
Use the '@mixin' directive, plus a name for your mixin. */
|
||||
|
||||
@mixin center {
|
||||
display: block;
|
||||
@ -82,7 +83,7 @@ div {
|
||||
background-color: $primary-color;
|
||||
}
|
||||
|
||||
/*Which would compile to: */
|
||||
/* Which would compile to: */
|
||||
div {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
@ -100,7 +101,7 @@ div {
|
||||
height: $height;
|
||||
}
|
||||
|
||||
/*Which you can invoke by passing width and height arguments. */
|
||||
/* Which you can invoke by passing width and height arguments. */
|
||||
|
||||
.rectangle {
|
||||
@include size(100px, 60px);
|
||||
@ -110,7 +111,7 @@ div {
|
||||
@include size(40px, 40px);
|
||||
}
|
||||
|
||||
/* This compiles to: */
|
||||
/* Compiles to: */
|
||||
.rectangle {
|
||||
width: 100px;
|
||||
height: 60px;
|
||||
@ -123,8 +124,8 @@ div {
|
||||
|
||||
|
||||
|
||||
/*Functions
|
||||
==============================*/
|
||||
/* Functions
|
||||
============================== */
|
||||
|
||||
|
||||
|
||||
@ -187,12 +188,12 @@ $main-content: calculate-percentage(600px, 960px);
|
||||
|
||||
|
||||
|
||||
/*Extend (Inheritance)
|
||||
==============================*/
|
||||
/* Extend (Inheritance)
|
||||
============================== */
|
||||
|
||||
|
||||
|
||||
/*Extend is a way to share the properties of one selector with another. */
|
||||
/* Extend is a way to share the properties of one selector with another. */
|
||||
|
||||
.display {
|
||||
@include size(5em, 5em);
|
||||
@ -216,7 +217,7 @@ $main-content: calculate-percentage(600px, 960px);
|
||||
}
|
||||
|
||||
/* Extending a CSS statement is preferable to creating a mixin
|
||||
because of the way it groups together the classes that all share
|
||||
because of the way Sass groups together the classes that all share
|
||||
the same base styling. If this was done with a mixin, the width,
|
||||
height, and border would be duplicated for each statement that
|
||||
called the mixin. While it won't affect your workflow, it will
|
||||
@ -224,12 +225,12 @@ $main-content: calculate-percentage(600px, 960px);
|
||||
|
||||
|
||||
|
||||
/*Nesting
|
||||
==============================*/
|
||||
/* Nesting
|
||||
============================== */
|
||||
|
||||
|
||||
|
||||
/*Sass allows you to nest selectors within selectors */
|
||||
/* Sass allows you to nest selectors within selectors */
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
@ -284,8 +285,8 @@ ul li a {
|
||||
|
||||
|
||||
|
||||
/*Partials and Imports
|
||||
==============================*/
|
||||
/* Partials and Imports
|
||||
============================== */
|
||||
|
||||
|
||||
|
||||
@ -329,8 +330,8 @@ body {
|
||||
|
||||
|
||||
|
||||
/*Placeholder Selectors
|
||||
==============================*/
|
||||
/* Placeholder Selectors
|
||||
============================== */
|
||||
|
||||
|
||||
|
||||
@ -366,8 +367,8 @@ body {
|
||||
|
||||
|
||||
|
||||
/*Math Operations
|
||||
==============================*/
|
||||
/* Math Operations
|
||||
============================== */
|
||||
|
||||
|
||||
|
||||
@ -418,11 +419,8 @@ body {
|
||||
width: 6.25%;
|
||||
}
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## SASS or Sass?
|
||||
Have you ever wondered whether Sass is an acronym or not? You probably haven't, but I'll tell you anyway. The name of the language is a word, "Sass", and not an acronym.
|
||||
Because people were constantly writing it as "SASS", the creator of the language jokingly called it "Syntactically Awesome StyleSheets".
|
||||
@ -434,7 +432,6 @@ You can use either syntax, just go into the settings and select either Sass or S
|
||||
|
||||
|
||||
## Compatibility
|
||||
|
||||
Sass can be used in any project as long as you have a program to compile it
|
||||
into CSS. You'll want to verify that the CSS you're using is compatible
|
||||
with your target browsers.
|
||||
|
Loading…
Reference in New Issue
Block a user