SlideShare a Scribd company logo
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>

More Related Content

PPTX
Start using less css
PDF
LESS, the CSS Preprocessor
PPTX
.Less - CSS done right
PDF
Using LESS, the CSS Preprocessor: J and Beyond 2013
PPT
An Introduction to CSS Preprocessors (SASS & LESS)
ODP
Sass presentation
PPTX
Introduction to SASS
PPT
CSS Preprocessors: LESS is more or look SASS-y trying
Start using less css
LESS, the CSS Preprocessor
.Less - CSS done right
Using LESS, the CSS Preprocessor: J and Beyond 2013
An Introduction to CSS Preprocessors (SASS & LESS)
Sass presentation
Introduction to SASS
CSS Preprocessors: LESS is more or look SASS-y trying

What's hot (20)

PPTX
Write LESS. DO more.
PPTX
PPT
Why less?
ODP
Deep dive into sass
KEY
Intro to SASS CSS
PPTX
SASS - Syntactically Awesome Stylesheet
PPTX
Syntactically awesome stylesheets (Sass)
PPTX
PDF
PDF
Pacific Northwest Drupal Summit: Basic & SASS
PDF
Css to-scss
PDF
Intro to Sass for WordPress Developers
PPTX
Css frameworks
PDF
How to use CSS3 in WordPress - Sacramento
PDF
Intro to css & sass
PDF
LESS
PDF
Haml And Sass In 15 Minutes
KEY
Advanced sass/compass
PPT
LESS(CSS preprocessor)
Write LESS. DO more.
Why less?
Deep dive into sass
Intro to SASS CSS
SASS - Syntactically Awesome Stylesheet
Syntactically awesome stylesheets (Sass)
Pacific Northwest Drupal Summit: Basic & SASS
Css to-scss
Intro to Sass for WordPress Developers
Css frameworks
How to use CSS3 in WordPress - Sacramento
Intro to css & sass
LESS
Haml And Sass In 15 Minutes
Advanced sass/compass
LESS(CSS preprocessor)
Ad

Similar to Less css (20)

PPTX
Doing More With Less
PDF
Doing more with LESS
PDF
Do more with {less}
PDF
Preprocessor presentation
PDF
Accelerated Stylesheets
KEY
Drupal & CSS Preprocessors
PDF
LESS is More
PDF
CSS Less framework overview, Pros and Cons
PDF
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
PDF
Sass and Compass - Getting Started
PDF
Exam 70 480 CSS3 at Jinal Desai .NET
PDF
Big Design Conference: CSS3
PDF
CSS Extenders
PDF
LeSS in action
PDF
Save time by using SASS/SCSS
KEY
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
PPTX
Oocss & progressive css3 selectors
KEY
Using Sass - Building on CSS
PPT
Doing More With Less
Doing more with LESS
Do more with {less}
Preprocessor presentation
Accelerated Stylesheets
Drupal & CSS Preprocessors
LESS is More
CSS Less framework overview, Pros and Cons
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Sass and Compass - Getting Started
Exam 70 480 CSS3 at Jinal Desai .NET
Big Design Conference: CSS3
CSS Extenders
LeSS in action
Save time by using SASS/SCSS
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Oocss & progressive css3 selectors
Using Sass - Building on CSS
Ad

More from Bill Chea (20)

PPTX
Xen cloud platform
PPTX
Why ruby
PPTX
Unix tc
PPTX
Sithi hub
PDF
Save time by using sass to develop css
PPTX
Safety social media for positive social change
PPTX
Open street map
PPTX
Open development cambodia
PPTX
Job hunting & career development
PDF
Internet security
PPTX
How to build up communication skill
PDF
Google mapmaker
PPTX
Financial job study travel planning
PPTX
Khmer TTS
PPTX
Khmer OCR
PDF
Khmer ASR
PPTX
ERP web based system
PDF
10 golden features of business website
PDF
UrbanVoicePDF
PDF
4 hour-workweek-blogger
Xen cloud platform
Why ruby
Unix tc
Sithi hub
Save time by using sass to develop css
Safety social media for positive social change
Open street map
Open development cambodia
Job hunting & career development
Internet security
How to build up communication skill
Google mapmaker
Financial job study travel planning
Khmer TTS
Khmer OCR
Khmer ASR
ERP web based system
10 golden features of business website
UrbanVoicePDF
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>