SlideShare una empresa de 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

Más contenido relacionado

La actualidad más candente

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

La actualidad más candente (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
 

Destacado

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
 

Destacado (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
 

Similar 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
 

Similar 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)
 

Más de Kianosh Pourian

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

Más 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

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
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
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
🐬 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 - 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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

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 del editor

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