SlideShare une entreprise Scribd logo
1  sur  12
Who am I?
What is LESS?
What is LESS?

 - LESS=The dynamic stylesheet language.

 - LESS extends the standard CSS syntax. This means that you can create a LESS
   stylesheet using regular CSS, and just add LESS code to the stylesheet as and
   when you need it.
Processing
Processing

 - The LESS compiler is written in JavaScript.

 - The compiler converts your LESS code into CSS when the browser loads the
   page
Why LESS?

- LESS has everything that CSS is missing.

- Features:
  1- Variables
  2- Mixins
  3- Nested rules
  4- Operators and functions
Variables

- When you program you can set a constant variable that you can access throughout
  your program.

- You can do the same with LESS. Set a variable named @red, add your favorite
  hex red color and use it in your stylesheet.

- Wanna change the color a bit? Just change the @red value and smile
Variables (Cons)
Ex:
 // LESS
 @color: #4D926F;
 #header {
   color: @color;
 }
 h2 { color: @color; }


 /* Compiled CSS */
 #header {
   color: #4D926F;
 }
 h2 {
   color: #4D926F;
 }
Mixins

- allow you to embed all the properties of a class into another class by simply
  including the class name as one of its properties.

Ex:

// LESS
.rounded-corners (@radius: 5px) {
  border-radius: @radius; -webkit-border-radius: @radius;
  -moz-border-radius: @radius;
}
 #header {
   .rounded-corners;
 }
 #footer {
  .rounded-corners(10px);
 }
/* Compiled CSS */
#header {
  border-radius: 5px;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
}
#footer {
  border-radius: 10px;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
}
Nested rules

- You can simply nest selectors inside other selectors.

- These can save you a lot of coding, and they make your code clearer.
  Bye bye long selectors!
Ex:
// LESS                        /* Compiled CSS */
#header {                      #header h1 {
  h1 {                           font-size: 26px;
    font-size: 26px;             font-weight: bold;
    font-weight: bold;         }
  }                            #header p {
  p{                             font-size: 12px;
    font-size: 12px;           }
    a{                         #header p a {
      text-decoration: none;     text-decoration: none;
     &:hover {                 }
       border-width: 1px       #header p a:hover {
     }                           border-width: 1px;
    }                          }
  }
 }
Operators and functions

- which let you create CSS properties mathematically.

Ex:
// LESS                                       /* Compiled CSS */
@the-border: 1px;                             #header {
@base-color: #111;                              color: #333;
@red: #842210;                                  border-left: 1px;
#header {                                       border-right: 2px;
  color: @base-color * 3;                     }
  border-left: @the-border;                   #footer {
  border-right: @the-border * 2;                color: #114411;
}                                               border-color: #7d2717;
#footer {                                     }
  color: @base-color + #003300;
  border-color: desaturate(@red, 10%);
}
Use

- Download: http://lesscss.org/

- <link rel="stylesheet/less" type="text/css" href="styles.less">
  <script src="less.js" type="text/javascript"></script>

Contenu connexe

Tendances

Write LESS. DO more.
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.Eugene Nor
 
Deep dive into sass
Deep dive into sassDeep dive into sass
Deep dive into sassKnoldus Inc.
 
SASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome StylesheetSASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome StylesheetNeha Sharma
 
Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)Tahmina Khatoon
 
Pacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASSPacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASSSteve Krueger
 
Intro to Sass for WordPress Developers
Intro to Sass for WordPress DevelopersIntro to Sass for WordPress Developers
Intro to Sass for WordPress DevelopersSuzette Franck
 
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 - SacramentoSuzette Franck
 
Intro to css & sass
Intro to css & sassIntro to css & sass
Intro to css & sassSean Wolfe
 
Haml And Sass In 15 Minutes
Haml And Sass In 15 MinutesHaml And Sass In 15 Minutes
Haml And Sass In 15 MinutesPatrick Crowley
 
Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compassNick Cooley
 
LESS(CSS preprocessor)
LESS(CSS preprocessor)LESS(CSS preprocessor)
LESS(CSS preprocessor)VIPIN KUMAR
 

Tendances (20)

Write LESS. DO more.
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.
 
Sass presentation
Sass presentationSass presentation
Sass presentation
 
Why less?
Why less?Why less?
Why less?
 
Deep dive into sass
Deep dive into sassDeep dive into sass
Deep dive into sass
 
Intro to SASS CSS
Intro to SASS CSSIntro to SASS CSS
Intro to SASS CSS
 
Less
LessLess
Less
 
SASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome StylesheetSASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome Stylesheet
 
Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)
 
Sass
SassSass
Sass
 
Sass
SassSass
Sass
 
Pacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASSPacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASS
 
Css to-scss
Css to-scssCss to-scss
Css to-scss
 
Intro to Sass for WordPress Developers
Intro to Sass for WordPress DevelopersIntro to Sass for WordPress Developers
Intro to Sass for WordPress Developers
 
Css frameworks
Css frameworksCss frameworks
Css frameworks
 
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
 
Intro to css & sass
Intro to css & sassIntro to css & sass
Intro to css & sass
 
LESS
LESSLESS
LESS
 
Haml And Sass In 15 Minutes
Haml And Sass In 15 MinutesHaml And Sass In 15 Minutes
Haml And Sass In 15 Minutes
 
Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compass
 
LESS(CSS preprocessor)
LESS(CSS preprocessor)LESS(CSS preprocessor)
LESS(CSS preprocessor)
 

Similaire à Less css

Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Startededgincvg
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With LessDavid Engel
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentationMario Noble
 
LESS : The dynamic stylesheet language
LESS : The dynamic stylesheet languageLESS : The dynamic stylesheet language
LESS : The dynamic stylesheet languageKatsunori Tanaka
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)emrox
 
Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesDinu Suman
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & CompassRob Davarnia
 
LESS is More
LESS is MoreLESS is More
LESS is Morejsmith92
 
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsKaelig Deloumeau-Prigent
 
CSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and ConsCSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and ConsSanjoy Kr. Paul
 
Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01Anam Hossain
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and howmirahman
 
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and CompassBringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and CompassClaudina Sarahe
 

Similaire à Less css (20)

CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
LESS : The dynamic stylesheet language
LESS : The dynamic stylesheet languageLESS : The dynamic stylesheet language
LESS : The dynamic stylesheet language
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS files
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
Do more with {less}
Do more with {less}Do more with {less}
Do more with {less}
 
LESS is More
LESS is MoreLESS is More
LESS is More
 
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
 
Less & Sass
Less & SassLess & Sass
Less & Sass
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
CSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and ConsCSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and Cons
 
Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
 
PostCss
PostCssPostCss
PostCss
 
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and CompassBringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
 
LESS CSS
LESS CSSLESS CSS
LESS CSS
 

Plus de Bill Chea

Xen cloud platform
Xen cloud platformXen cloud platform
Xen cloud platformBill Chea
 
Save time by using sass to develop css
Save time by using sass to develop cssSave time by using sass to develop css
Save time by using sass to develop cssBill Chea
 
Safety social media for positive social change
Safety social media for positive social changeSafety social media for positive social change
Safety social media for positive social changeBill Chea
 
Open street map
Open street mapOpen street map
Open street mapBill Chea
 
Open development cambodia
Open development cambodiaOpen development cambodia
Open development cambodiaBill Chea
 
Job hunting & career development
Job hunting & career developmentJob hunting & career development
Job hunting & career developmentBill Chea
 
Internet security
Internet securityInternet security
Internet securityBill Chea
 
How to build up communication skill
How to build up communication skillHow to build up communication skill
How to build up communication skillBill Chea
 
Google mapmaker
Google mapmakerGoogle mapmaker
Google mapmakerBill Chea
 
Financial job study travel planning
Financial job study travel planningFinancial job study travel planning
Financial job study travel planningBill Chea
 
ERP web based system
ERP web based systemERP web based system
ERP web based systemBill Chea
 
10 golden features of business website
10 golden features of business website10 golden features of business website
10 golden features of business websiteBill Chea
 
UrbanVoicePDF
UrbanVoicePDFUrbanVoicePDF
UrbanVoicePDFBill Chea
 
4 hour-workweek-blogger
4 hour-workweek-blogger4 hour-workweek-blogger
4 hour-workweek-bloggerBill Chea
 

Plus de Bill Chea (20)

Xen cloud platform
Xen cloud platformXen cloud platform
Xen cloud platform
 
Why ruby
Why rubyWhy ruby
Why ruby
 
Unix tc
Unix tcUnix tc
Unix tc
 
Sithi hub
Sithi hubSithi hub
Sithi hub
 
Save time by using sass to develop css
Save time by using sass to develop cssSave time by using sass to develop css
Save time by using sass to develop css
 
Safety social media for positive social change
Safety social media for positive social changeSafety social media for positive social change
Safety social media for positive social change
 
Open street map
Open street mapOpen street map
Open street map
 
Open development cambodia
Open development cambodiaOpen development cambodia
Open development cambodia
 
Job hunting & career development
Job hunting & career developmentJob hunting & career development
Job hunting & career development
 
Internet security
Internet securityInternet security
Internet security
 
How to build up communication skill
How to build up communication skillHow to build up communication skill
How to build up communication skill
 
Google mapmaker
Google mapmakerGoogle mapmaker
Google mapmaker
 
Financial job study travel planning
Financial job study travel planningFinancial job study travel planning
Financial job study travel planning
 
Khmer TTS
Khmer TTSKhmer TTS
Khmer TTS
 
Khmer OCR
Khmer OCRKhmer OCR
Khmer OCR
 
Khmer ASR
Khmer ASRKhmer ASR
Khmer ASR
 
ERP web based system
ERP web based systemERP web based system
ERP web based system
 
10 golden features of business website
10 golden features of business website10 golden features of business website
10 golden features of business website
 
UrbanVoicePDF
UrbanVoicePDFUrbanVoicePDF
UrbanVoicePDF
 
4 hour-workweek-blogger
4 hour-workweek-blogger4 hour-workweek-blogger
4 hour-workweek-blogger
 

Less css

  • 2. What is LESS? What is LESS? - LESS=The dynamic stylesheet language. - LESS extends the standard CSS syntax. This means that you can create a LESS stylesheet using regular CSS, and just add LESS code to the stylesheet as and when you need it.
  • 3. Processing Processing - The LESS compiler is written in JavaScript. - The compiler converts your LESS code into CSS when the browser loads the page
  • 4. Why LESS? - LESS has everything that CSS is missing. - Features: 1- Variables 2- Mixins 3- Nested rules 4- Operators and functions
  • 5. Variables - When you program you can set a constant variable that you can access throughout your program. - You can do the same with LESS. Set a variable named @red, add your favorite hex red color and use it in your stylesheet. - Wanna change the color a bit? Just change the @red value and smile
  • 6. Variables (Cons) Ex: // LESS @color: #4D926F; #header { color: @color; } h2 { color: @color; } /* Compiled CSS */ #header { color: #4D926F; } h2 { color: #4D926F; }
  • 7. Mixins - allow you to embed all the properties of a class into another class by simply including the class name as one of its properties. Ex: // LESS .rounded-corners (@radius: 5px) { border-radius: @radius; -webkit-border-radius: @radius; -moz-border-radius: @radius; } #header { .rounded-corners; } #footer { .rounded-corners(10px); }
  • 8. /* Compiled CSS */ #header { border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; } #footer { border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px; }
  • 9. Nested rules - You can simply nest selectors inside other selectors. - These can save you a lot of coding, and they make your code clearer. Bye bye long selectors!
  • 10. Ex: // LESS /* Compiled CSS */ #header { #header h1 { h1 { font-size: 26px; font-size: 26px; font-weight: bold; font-weight: bold; } } #header p { p{ font-size: 12px; font-size: 12px; } a{ #header p a { text-decoration: none; text-decoration: none; &:hover { } border-width: 1px #header p a:hover { } border-width: 1px; } } } }
  • 11. Operators and functions - which let you create CSS properties mathematically. Ex: // LESS /* Compiled CSS */ @the-border: 1px; #header { @base-color: #111; color: #333; @red: #842210; border-left: 1px; #header { border-right: 2px; color: @base-color * 3; } border-left: @the-border; #footer { border-right: @the-border * 2; color: #114411; } border-color: #7d2717; #footer { } color: @base-color + #003300; border-color: desaturate(@red, 10%); }
  • 12. Use - Download: http://lesscss.org/ - <link rel="stylesheet/less" type="text/css" href="styles.less"> <script src="less.js" type="text/javascript"></script>