SlideShare uma empresa Scribd logo
1 de 12
INTRO TO SASS CSS
        Kianosh Pourian


     Wifi
     username: BCGUEST
     password: 290Congress
About Me
Kianosh Pourian
Pixel Architect/Independent Contractor
Blog on: http://innovatorylife.com
Twitter: @kianoshp
About Me
Kianosh Pourian
Pixel Architect/Independent Contractor
Blog on: http://innovatorylife.com
Twitter: @kianoshp
SASS CSS
Ruby engine compiler for CSS
Extending the benefits of CSS by allowing nested rules, variables,
mixins, selector inheritance, and more.
http://sass-lang.com/
Other equivalent pre-processors:
  Javascript: LESS - http://lesscss.org/
  Stylus: http://learnboost.github.com/stylus/
  Closure Stylesheets
Pros & Cons of SASS
              Pros                          Cons

•Uniform CSS                    •Reliance of a compiler
•Abstraction of commonly used   •All or nothing
 CSS - mixins                   •Disconnect between CSS and
•Ability to create functions     SASS CSS in dev consoles
•Variables
•Nesting
•Inheritance
•COMPASS!!
Variables
In CSS we widely use common values for different element styles.

For example, we use colors, width, height, etc... throughout our CSS styles.

With variables, these common values can be declared once and re-used throughout the
stylesheets.

Example:
 $tableColor: #F3F1EB;
 $tableBorderColor: #EFEFEF;
 @mixin sortBg {
 !    background:$tableColor url('../img/bg.gif') no-repeat right center;
 !    &:hover {
 !    !     background-color: darken($tableColor, 25%);
 !    }
 }
Nesting
To avoid repetition, nested rules and selectors will help in this effort

Examples

SCSS file                                   CSS output
table.hl {                                  table.hl {
  margin: 2em 0;                              margin: 2em 0;
  td.ln {                                   }
    text-align: right;                      table.hl td.ln {
  }                                           text-align: right;
}                                           }

li {                                        li {
  font: {                                     font-family: serif;
     family: serif;                           font-weight: bold;
     weight: bold;                            font-size: 1.2em;
     size: 1.2em;                           }
  }
}
Mixins
Mixins are a very potent asset of SASS.

With mixins, the most commonly used CSS can be abstracted to a mixin and included as
needed.

Example:

  @mixin handCursor {
  !   cursor: hand;
  !   cursor: pointer;
  }
Mixins - Advanced
Mixins can become very advanced and can contain logic .

Example - setting Linear Gradients - http://kiano.sh/IjEpZm

Example:
@mixin add-border($border-position: all, $border-size: 1px, $border-
pattern: solid, $border-color: #000) {

!   @if $border-position == 'all' {

!   !    border: $border-size $border-pattern $border-color;

!   } @else {

!   !    border-#{$border-position}: $border-size $border-pattern
$border-color;

!   }

}
Functions
Functions allow for computation logic.

Functions return values.

Example:

@function responsiveFontSize($fontSize: 16, $isIE: false) {
!    @if $isIE {
!    !     @return (($fontSize/16) - 0.02) + em;
!    } @else {
!    !     @return ($fontSize/16) + em;
!    }
}
@function rfs($fontSize: 16, $isIE: false) {
!    @return responsiveFontSize($fontSize, $isIE);
}
COMPASS
“...open-source CSS authoring framework which uses the Sass stylesheet language to make
writing stylesheets powerful and easy.”

Provides a number of community-created mixins and modules to help integrate some of the
most popular design patterns on the web.

X-Browser CSS3 mixins: Rounded Corners, Gradients, Box Shadow, Text Shadow, etc...

Common CSS development patterns: reset css, clearfix, sprites, etc...
Further reading
SASS CSS - www.sass-lang.com

COMPASS - http://compass-style.org/

SASS Cocktails - collections of SASS mixins and functions - http://kiano.sh/J89RI9

SASS CSS Boilerplate - http://kiano.sh/IlZt2b

Thoughtbot/bourbon - Series of mixins and functions - http://kiano.sh/IQNOZ6



How to write a well structured CSS - Part 1 http://kiano.sh/Inxxym & Part 2 http://
kiano.sh/LaVS65

Feel free to tweet me a questions, twitter: @kianoshp

blog: http://innovatorylife.com

Mais conteúdo relacionado

Mais procurados

CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
mirahman
 

Mais procurados (19)

Pacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASSPacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASS
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
 
CSS 101
CSS 101CSS 101
CSS 101
 
CSS
CSSCSS
CSS
 
Css basics
Css basicsCss basics
Css basics
 
.Less - CSS done right
.Less - CSS done right.Less - CSS done right
.Less - CSS done right
 
4. Web Technology CSS Basics-1
4. Web Technology CSS Basics-14. Web Technology CSS Basics-1
4. Web Technology CSS Basics-1
 
Intro to Sass for WordPress Developers
Intro to Sass for WordPress DevelopersIntro to Sass for WordPress Developers
Intro to Sass for WordPress Developers
 
2 introduction css
2 introduction css2 introduction css
2 introduction css
 
The Dark Arts of CSS
The Dark Arts of CSSThe Dark Arts of CSS
The Dark Arts of CSS
 
How to use CSS3 in WordPress - Sacramento
How to use CSS3 in WordPress - SacramentoHow to use CSS3 in WordPress - Sacramento
How to use CSS3 in WordPress - Sacramento
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Css3
Css3Css3
Css3
 
CSS Introduction
CSS IntroductionCSS Introduction
CSS Introduction
 
Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)
 
[Worskhop Summits] CSS3 Workshop
[Worskhop Summits] CSS3 Workshop[Worskhop Summits] CSS3 Workshop
[Worskhop Summits] CSS3 Workshop
 
Cascading style sheets - CSS
Cascading style sheets - CSSCascading style sheets - CSS
Cascading style sheets - CSS
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 

Destaque

Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASS
Jon Dean
 
Using scss-at-noisestreet
Using scss-at-noisestreetUsing scss-at-noisestreet
Using scss-at-noisestreet
Wei Pin Teo
 

Destaque (12)

Sass - Getting Started with Sass!
Sass - Getting Started with Sass!Sass - Getting Started with Sass!
Sass - Getting Started with Sass!
 
Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASS
 
Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)
 
Sass presentation
Sass presentationSass presentation
Sass presentation
 
CSS Best Practices
CSS Best PracticesCSS Best Practices
CSS Best Practices
 
Using scss-at-noisestreet
Using scss-at-noisestreetUsing scss-at-noisestreet
Using scss-at-noisestreet
 
Getting Started With Sass | WC Philly 2015
Getting Started With Sass | WC Philly 2015Getting Started With Sass | WC Philly 2015
Getting Started With Sass | WC Philly 2015
 
Getting SASSy with front end development
Getting SASSy with front end developmentGetting SASSy with front end development
Getting SASSy with front end development
 
Sass: Introduction
Sass: IntroductionSass: Introduction
Sass: Introduction
 
CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3
 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
 
Sass
SassSass
Sass
 

Semelhante a Intro to SASS CSS

Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
edgincvg
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
Zeeshan Ahmed
 
Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)
elliando dias
 

Semelhante a Intro to SASS CSS (20)

Advanced sass
Advanced sassAdvanced sass
Advanced sass
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
 
Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
 
SASS Lecture
SASS Lecture SASS Lecture
SASS Lecture
 
Less css
Less cssLess css
Less css
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
 
AAVN_Presentation_SASS.pptx
AAVN_Presentation_SASS.pptxAAVN_Presentation_SASS.pptx
AAVN_Presentation_SASS.pptx
 
An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)
 
Why less?
Why less?Why less?
Why less?
 
Sass
SassSass
Sass
 
Modularization css with sass
Modularization css with sassModularization css with sass
Modularization css with sass
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
Web Typography
Web TypographyWeb Typography
Web Typography
 
CSS Presentation Notes.pptx
CSS Presentation Notes.pptxCSS Presentation Notes.pptx
CSS Presentation Notes.pptx
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)
 

Mais de Kianosh Pourian

Why are preprocessors divisive
Why are preprocessors divisiveWhy are preprocessors divisive
Why are preprocessors divisive
Kianosh Pourian
 

Mais de Kianosh Pourian (6)

Unbloat your SDLC
Unbloat your SDLCUnbloat your SDLC
Unbloat your SDLC
 
Would you like some Grids with that?
Would you like some Grids with that?Would you like some Grids with that?
Would you like some Grids with that?
 
Introvert & extrovert: The melting pot of development
Introvert & extrovert: The melting pot of developmentIntrovert & extrovert: The melting pot of development
Introvert & extrovert: The melting pot of development
 
Passport Nodejs Lightening Talk
Passport Nodejs Lightening TalkPassport Nodejs Lightening Talk
Passport Nodejs Lightening Talk
 
Why are preprocessors divisive
Why are preprocessors divisiveWhy are preprocessors divisive
Why are preprocessors divisive
 
Intro to KnockoutJS
Intro to KnockoutJSIntro to KnockoutJS
Intro to KnockoutJS
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Intro to SASS CSS

  • 1. INTRO TO SASS CSS Kianosh Pourian Wifi username: BCGUEST password: 290Congress
  • 2. About Me Kianosh Pourian Pixel Architect/Independent Contractor Blog on: http://innovatorylife.com Twitter: @kianoshp
  • 3. About Me Kianosh Pourian Pixel Architect/Independent Contractor Blog on: http://innovatorylife.com Twitter: @kianoshp
  • 4. SASS CSS Ruby engine compiler for CSS Extending the benefits of CSS by allowing nested rules, variables, mixins, selector inheritance, and more. http://sass-lang.com/ Other equivalent pre-processors: Javascript: LESS - http://lesscss.org/ Stylus: http://learnboost.github.com/stylus/ Closure Stylesheets
  • 5. Pros & Cons of SASS Pros Cons •Uniform CSS •Reliance of a compiler •Abstraction of commonly used •All or nothing CSS - mixins •Disconnect between CSS and •Ability to create functions SASS CSS in dev consoles •Variables •Nesting •Inheritance •COMPASS!!
  • 6. Variables In CSS we widely use common values for different element styles. For example, we use colors, width, height, etc... throughout our CSS styles. With variables, these common values can be declared once and re-used throughout the stylesheets. Example: $tableColor: #F3F1EB; $tableBorderColor: #EFEFEF; @mixin sortBg { ! background:$tableColor url('../img/bg.gif') no-repeat right center; ! &:hover { ! ! background-color: darken($tableColor, 25%); ! } }
  • 7. Nesting To avoid repetition, nested rules and selectors will help in this effort Examples SCSS file CSS output table.hl { table.hl { margin: 2em 0; margin: 2em 0; td.ln { } text-align: right; table.hl td.ln { } text-align: right; } } li { li { font: { font-family: serif; family: serif; font-weight: bold; weight: bold; font-size: 1.2em; size: 1.2em; } } }
  • 8. Mixins Mixins are a very potent asset of SASS. With mixins, the most commonly used CSS can be abstracted to a mixin and included as needed. Example: @mixin handCursor { ! cursor: hand; ! cursor: pointer; }
  • 9. Mixins - Advanced Mixins can become very advanced and can contain logic . Example - setting Linear Gradients - http://kiano.sh/IjEpZm Example: @mixin add-border($border-position: all, $border-size: 1px, $border- pattern: solid, $border-color: #000) { ! @if $border-position == 'all' { ! ! border: $border-size $border-pattern $border-color; ! } @else { ! ! border-#{$border-position}: $border-size $border-pattern $border-color; ! } }
  • 10. Functions Functions allow for computation logic. Functions return values. Example: @function responsiveFontSize($fontSize: 16, $isIE: false) { ! @if $isIE { ! ! @return (($fontSize/16) - 0.02) + em; ! } @else { ! ! @return ($fontSize/16) + em; ! } } @function rfs($fontSize: 16, $isIE: false) { ! @return responsiveFontSize($fontSize, $isIE); }
  • 11. COMPASS “...open-source CSS authoring framework which uses the Sass stylesheet language to make writing stylesheets powerful and easy.” Provides a number of community-created mixins and modules to help integrate some of the most popular design patterns on the web. X-Browser CSS3 mixins: Rounded Corners, Gradients, Box Shadow, Text Shadow, etc... Common CSS development patterns: reset css, clearfix, sprites, etc...
  • 12. Further reading SASS CSS - www.sass-lang.com COMPASS - http://compass-style.org/ SASS Cocktails - collections of SASS mixins and functions - http://kiano.sh/J89RI9 SASS CSS Boilerplate - http://kiano.sh/IlZt2b Thoughtbot/bourbon - Series of mixins and functions - http://kiano.sh/IQNOZ6 How to write a well structured CSS - Part 1 http://kiano.sh/Inxxym & Part 2 http:// kiano.sh/LaVS65 Feel free to tweet me a questions, twitter: @kianoshp blog: http://innovatorylife.com

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n