-
Notifications
You must be signed in to change notification settings - Fork 0
Advanced CSS
Nikolina Djekic edited this page Oct 3, 2019
·
2 revisions
- Sass Features
- Sass Syntax
- Sass Functionality
- Variables
- Mixins
- Nesting
- Extends
- Functions
- Variables
- Variables
-
Variables
- reusable values--> colors, font-sizes, spacing
-
Nesting
- for nesting selectors inside on another for less code
-
Operators
- for mathematical operations inside CSS
-
Partials and imports
- to write CSS in diff files and import them all into one single file
-
Mixins
- for writing reusable pieces of CSS code
-
Functions
- similar to Mixins, but its value can be used later
-
Extends
- to make dif selectors inherit declarations that are common to all of them
-
Control directives
- to write complex code using conditionals and loops
-
Sass syntax
.navigation list-style: none float: left & li display: inline-block margin-left: 30px
-
SCSS Syntax
.navigation { list-style: none; float: left; & li { display: inline-block; margin-left: 30px; } }
-
Comments
- // inline comments
- Declaration $name: value;
-
Mixin declaration
@mixin ime(argument){ /*sta god*/ }
-
Mixin call
@include ime(argument);
- Inside one class declaration we can put nested classes, just indent them
- When we need deeper nesting we can put & sign which represents all the path to that element
when we have same principals in multiple selectors
-
Declaring it
%ime{ /*sta god*/ } -
Calling it*
@extend %ime;
-
Declaring runctions
@function ime(arg1, arg2){ @return ; }
-
Function call
ime(arg1, arg2) * 1 jedinica;
-
Color functions
- darken(color, percentage);
- lighten(color, percentage);
Written by Ninna94