SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Doing More with LESSfor CSS T: @toddanglin | E: anglin@telerik.com
Introductions Todd Anglin Chief Evangelist, Telerik Microsoft MVP ASP Insider President NHDNUG & O’Reilly Author TelerikWatch.com @toddanglin
What will we cover?
why do we need CSS?
[before CSS] {HTML} <html>   <head>…</head>    <body>       <table>      <tr><td>      <font size=“3” color=“red”>         <h1>Hello World!</h1>      </font>      </td></tr>      <font color=“green”>          <font face=“Tahoma”>            <h2>I’m green! I think.</h2>         </font>         <p>Loremipsum</p>      </font>       </table>    </body> </html>
Separation of Concerns* {CSS} {HTML} <html>   <head>…</head>    <body>      <header>…</header>       <article>         <h1>Hello!</h1>        <p>Loremipsum</p>      </article>       <nav>…</nav>       <footer>…</footer>    </body> </html> body { color:#FFF; } header { margin:5px; } article {    margin:5px 0;   padding: 10px;   background: #333; } style structure
CSS Zen Garden
what is the key CSS challenge?
Browser Interoperability Browsers implement CSS differently .t-button { padding: 2px 8px; } *+html .t-button { padding: 1px 8px; } .t-icon, .t-sprite, .t-editor-button .t-tool-icon {    display: inline-block; *display: inline;    text-indent: -9999px; } * html .t-icon, .t-sprite { text-indent: 0; } *+html .t-icon, .t-sprite { text-indent: 0; }
IE6 is the [CSS] devil. Microsoft agrees. ie6countdown.com
CSS3
What’s CSS3? Extensions for CSS2.1 Add functionality, refine definitions
Browser Prefixes 15
-moz-border-radius: 5px 5px5px5px;  -webkit-border-radius: 5px; border-radius: 5px; -moz-box-shadow: 2px 2px2px #333; -webkit-box-shadow: 2px 2px2px #333; box-shadow: 2px 2px2px #333; -webkit-background-size: 137px 50px; -o-background-size: 137px 50px; background-size: 137px 50px;
CSS3 IN ACTION	 DEMO
wouldn’t it be nice if CSS…
Made it easier to target different browsers Supported global variables Made it easier to do DRY CSS Simplified complicated style hierarchies
LESS for CSS Use LESS to write less CSS Variables, operations, mix-ins, nested rules lesscss.org LESS is CSS
What LESS does NOT do Does not… Add CSS support to browsers Detect CSS support in browsers Save you from writing bad CSS Add runtime overhead*
Variables Reusable values Can only be defined once Output CSS LESS @nice-blue: #5B83AD; @light-blue: @nice-blue + #111; #header { color: @light-blue; } #header { color: #6c94be; }
Operations In-line CSS operations Any number, color, or variable Output CSS LESS @base: 5%; @filler: @base * 2; @other: @base + @filler; @base-color: #C9C9C9; .rule{ color: #888 / 4; background-color: @base-color + #111; height: 100% / 2 + @filler; } .rule {   color: #222222;   background-color: #dadada;   height: 60%; }
Mix-ins Encapsulated CSS rule sets Reusable Can accept parameters Output CSS LESS /*LESS Mix-in*/ .border-radius (@radius) {   -moz-border-radius: @radius;   -webkit-border-radius: @radius;  border-radius: @radius; } #header { .border-radius(4px); } #header {    -moz-border-radius: 4px;   -webkit-border-radius: 4px;   border-radius: 4px; }
Nested Rules Simplifies complicated CSS rule naming Output CSS LESS #header {   color: black;   .navigation {     font-size: 12px; }   .logo {     width: 300px;     &:hover { text-decoration: none }   } } #header { color: black; } #header .navigation {   font-size: 12px; } #header .logo {    width: 300px;  } #header .logo:hover{   text-decoration: none; }
Different Ways to Use LESS Dynamic parsing client-side Dynamic parsing server-side ASP.NET Handler Design-time/Building-time parsing Chirpy for VS <link rel="stylesheet/less" href="style.less" type="text/css" /> <script src="http://lesscss.googlecode.com/files/less-1.0.21.min.js"></script>
Can you do more with LESS?
Your Feedback is Important Please fill out a session evaluation form drop it off at the conference registration desk. Thank you! telerikwatch.com @toddanglin anglin@telerik.com
Doing More with LESS for CSS

Weitere ähnliche Inhalte

Was ist angesagt?

Web Fundamentals Crash Course
Web Fundamentals Crash CourseWeb Fundamentals Crash Course
Web Fundamentals Crash Course
MrAbas
 

Was ist angesagt? (20)

Introduction to web development
Introduction to web developmentIntroduction to web development
Introduction to web development
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
 
HTML CSS and Web Development
HTML CSS and Web DevelopmentHTML CSS and Web Development
HTML CSS and Web Development
 
Word press development for non developers
Word press development for non developers Word press development for non developers
Word press development for non developers
 
Front-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overview
 
HTML5: An Overview
HTML5: An OverviewHTML5: An Overview
HTML5: An Overview
 
Front End Tooling and Performance - Codeaholics HK 2015
Front End Tooling and Performance - Codeaholics HK 2015Front End Tooling and Performance - Codeaholics HK 2015
Front End Tooling and Performance - Codeaholics HK 2015
 
Html5 Overview
Html5 OverviewHtml5 Overview
Html5 Overview
 
Please dont touch-3.6-jsday
Please dont touch-3.6-jsdayPlease dont touch-3.6-jsday
Please dont touch-3.6-jsday
 
Web Fundamentals Crash Course
Web Fundamentals Crash CourseWeb Fundamentals Crash Course
Web Fundamentals Crash Course
 
EECI2009 - From Design to Dynamic - Rapid ExpressionEngine Development
EECI2009 - From Design to Dynamic - Rapid ExpressionEngine DevelopmentEECI2009 - From Design to Dynamic - Rapid ExpressionEngine Development
EECI2009 - From Design to Dynamic - Rapid ExpressionEngine Development
 
Test-proof CSS
Test-proof CSSTest-proof CSS
Test-proof CSS
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and Techniques
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applications
 
HTML5+CSS3 (入門編)
HTML5+CSS3 (入門編)HTML5+CSS3 (入門編)
HTML5+CSS3 (入門編)
 
HTML5 Introduction
HTML5 IntroductionHTML5 Introduction
HTML5 Introduction
 
How to Prepare a WordPress Theme for Public Release
How to Prepare a WordPress Theme for Public ReleaseHow to Prepare a WordPress Theme for Public Release
How to Prepare a WordPress Theme for Public Release
 
Developing a Web Application
Developing a Web ApplicationDeveloping a Web Application
Developing a Web Application
 
HTML5 & CSS3
HTML5 & CSS3 HTML5 & CSS3
HTML5 & CSS3
 
Building a Moodle theme with bootstrap
Building a Moodle theme with bootstrapBuilding a Moodle theme with bootstrap
Building a Moodle theme with bootstrap
 

Ähnlich wie Doing More with LESS for CSS

1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
apnwebdev
 
introduction to web technology
introduction to web technologyintroduction to web technology
introduction to web technology
vikram singh
 

Ähnlich wie Doing More with LESS for CSS (20)

1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
 
Css
CssCss
Css
 
CSS
CSSCSS
CSS
 
ppt dev devolpment.pptx
ppt dev devolpment.pptxppt dev devolpment.pptx
ppt dev devolpment.pptx
 
CSS Best practices
CSS Best practicesCSS Best practices
CSS Best practices
 
Making Your Site Look Great in IE7
Making Your Site Look Great in IE7Making Your Site Look Great in IE7
Making Your Site Look Great in IE7
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucks
 
Using a CSS Framework
Using a CSS FrameworkUsing a CSS Framework
Using a CSS Framework
 
HTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptHTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.ppt
 
css.ppt
css.pptcss.ppt
css.ppt
 
css.ppt
css.pptcss.ppt
css.ppt
 
Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSS
 
Embrace the Mullet: CSS is the 'Party in the Back' (a CSS How-to)
Embrace the Mullet: CSS is the 'Party in the Back' (a CSS How-to)Embrace the Mullet: CSS is the 'Party in the Back' (a CSS How-to)
Embrace the Mullet: CSS is the 'Party in the Back' (a CSS How-to)
 
Hardboiled Web Design
Hardboiled Web DesignHardboiled Web Design
Hardboiled Web Design
 
Advance Css
Advance CssAdvance Css
Advance Css
 
Advance Css 1194323118268797 5
Advance Css 1194323118268797 5Advance Css 1194323118268797 5
Advance Css 1194323118268797 5
 
WordPress Development Confoo 2010
WordPress Development Confoo 2010WordPress Development Confoo 2010
WordPress Development Confoo 2010
 
Not Just a Pretty Face: How to design and build a cross-CMS CSS framework
Not Just a Pretty Face: How to design and build a cross-CMS CSS frameworkNot Just a Pretty Face: How to design and build a cross-CMS CSS framework
Not Just a Pretty Face: How to design and build a cross-CMS CSS framework
 
Basic html tags
Basic html tagsBasic html tags
Basic html tags
 
introduction to web technology
introduction to web technologyintroduction to web technology
introduction to web technology
 

Mehr von Todd Anglin

HTML5 Mullet: Forms & Input Validation
HTML5 Mullet: Forms & Input ValidationHTML5 Mullet: Forms & Input Validation
HTML5 Mullet: Forms & Input Validation
Todd Anglin
 

Mehr von Todd Anglin (14)

NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularNativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
 
Making HTML5 Work Everywhere
Making HTML5 Work EverywhereMaking HTML5 Work Everywhere
Making HTML5 Work Everywhere
 
Developing a Modern Mobile App Strategy
Developing a Modern Mobile App StrategyDeveloping a Modern Mobile App Strategy
Developing a Modern Mobile App Strategy
 
HTML5 Bootcamp: Essential HTML, CSS, & JavaScript
HTML5 Bootcamp: Essential HTML, CSS, & JavaScriptHTML5 Bootcamp: Essential HTML, CSS, & JavaScript
HTML5 Bootcamp: Essential HTML, CSS, & JavaScript
 
HTML5 Mullet: Forms & Input Validation
HTML5 Mullet: Forms & Input ValidationHTML5 Mullet: Forms & Input Validation
HTML5 Mullet: Forms & Input Validation
 
5 Tips for Better JavaScript
5 Tips for Better JavaScript5 Tips for Better JavaScript
5 Tips for Better JavaScript
 
50in50: Resources for HTML5, CSS3, & JavaScript Developers
50in50: Resources for HTML5, CSS3, & JavaScript Developers50in50: Resources for HTML5, CSS3, & JavaScript Developers
50in50: Resources for HTML5, CSS3, & JavaScript Developers
 
Using HTML5 to Build Mobile Apps
Using HTML5 to Build Mobile AppsUsing HTML5 to Build Mobile Apps
Using HTML5 to Build Mobile Apps
 
HTML5 for Tablets and Mobile
HTML5 for Tablets and MobileHTML5 for Tablets and Mobile
HTML5 for Tablets and Mobile
 
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET DevelopersAccelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
 
Building RESTful Applications with OData
Building RESTful Applications with ODataBuilding RESTful Applications with OData
Building RESTful Applications with OData
 
Building a Testable Data Access Layer
Building a Testable Data Access LayerBuilding a Testable Data Access Layer
Building a Testable Data Access Layer
 
HTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayHTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use Today
 
What’s New in ASP.NET 4
What’s New in ASP.NET 4What’s New in ASP.NET 4
What’s New in ASP.NET 4
 

Kürzlich hochgeladen

poliovirus-190801072449. pptx
poliovirus-190801072449.            pptxpoliovirus-190801072449.            pptx
poliovirus-190801072449. pptx
ssuser0ad194
 
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证
eeanqy
 
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
ehyxf
 
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
wpkuukw
 
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
gajnagarg
 
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
eeanqy
 
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
gajnagarg
 
ab-initio-training basics and architecture
ab-initio-training basics and architectureab-initio-training basics and architecture
ab-initio-training basics and architecture
saipriyacoool
 

Kürzlich hochgeladen (20)

Sweety Planet Packaging Design Process Book.pptx
Sweety Planet Packaging Design Process Book.pptxSweety Planet Packaging Design Process Book.pptx
Sweety Planet Packaging Design Process Book.pptx
 
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdfJordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
 
poliovirus-190801072449. pptx
poliovirus-190801072449.            pptxpoliovirus-190801072449.            pptx
poliovirus-190801072449. pptx
 
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证
 
Essential UI/UX Design Principles: A Comprehensive Guide
Essential UI/UX Design Principles: A Comprehensive GuideEssential UI/UX Design Principles: A Comprehensive Guide
Essential UI/UX Design Principles: A Comprehensive Guide
 
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
 
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
 
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
 
Independent Escorts Goregaon WhatsApp +91-9930687706, Best Service
Independent Escorts Goregaon WhatsApp +91-9930687706, Best ServiceIndependent Escorts Goregaon WhatsApp +91-9930687706, Best Service
Independent Escorts Goregaon WhatsApp +91-9930687706, Best Service
 
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
 
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
 
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
 
The hottest UI and UX Design Trends 2024
The hottest UI and UX Design Trends 2024The hottest UI and UX Design Trends 2024
The hottest UI and UX Design Trends 2024
 
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEKLANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
 
How to Create a Productive Workspace Trends and Tips.pdf
How to Create a Productive Workspace Trends and Tips.pdfHow to Create a Productive Workspace Trends and Tips.pdf
How to Create a Productive Workspace Trends and Tips.pdf
 
TRose UXPA Experience Design Concord .pptx
TRose UXPA Experience Design Concord .pptxTRose UXPA Experience Design Concord .pptx
TRose UXPA Experience Design Concord .pptx
 
Q4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationQ4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentation
 
ab-initio-training basics and architecture
ab-initio-training basics and architectureab-initio-training basics and architecture
ab-initio-training basics and architecture
 
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...
 
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
 

Doing More with LESS for CSS

  • 1. Doing More with LESSfor CSS T: @toddanglin | E: anglin@telerik.com
  • 2. Introductions Todd Anglin Chief Evangelist, Telerik Microsoft MVP ASP Insider President NHDNUG & O’Reilly Author TelerikWatch.com @toddanglin
  • 3. What will we cover?
  • 4. why do we need CSS?
  • 5. [before CSS] {HTML} <html> <head>…</head> <body> <table> <tr><td> <font size=“3” color=“red”> <h1>Hello World!</h1> </font> </td></tr> <font color=“green”> <font face=“Tahoma”> <h2>I’m green! I think.</h2> </font> <p>Loremipsum</p> </font> </table> </body> </html>
  • 6. Separation of Concerns* {CSS} {HTML} <html> <head>…</head> <body> <header>…</header> <article> <h1>Hello!</h1> <p>Loremipsum</p> </article> <nav>…</nav> <footer>…</footer> </body> </html> body { color:#FFF; } header { margin:5px; } article { margin:5px 0; padding: 10px; background: #333; } style structure
  • 8. what is the key CSS challenge?
  • 9. Browser Interoperability Browsers implement CSS differently .t-button { padding: 2px 8px; } *+html .t-button { padding: 1px 8px; } .t-icon, .t-sprite, .t-editor-button .t-tool-icon { display: inline-block; *display: inline; text-indent: -9999px; } * html .t-icon, .t-sprite { text-indent: 0; } *+html .t-icon, .t-sprite { text-indent: 0; }
  • 10. IE6 is the [CSS] devil. Microsoft agrees. ie6countdown.com
  • 11. CSS3
  • 12. What’s CSS3? Extensions for CSS2.1 Add functionality, refine definitions
  • 14. -moz-border-radius: 5px 5px5px5px; -webkit-border-radius: 5px; border-radius: 5px; -moz-box-shadow: 2px 2px2px #333; -webkit-box-shadow: 2px 2px2px #333; box-shadow: 2px 2px2px #333; -webkit-background-size: 137px 50px; -o-background-size: 137px 50px; background-size: 137px 50px;
  • 16. wouldn’t it be nice if CSS…
  • 17. Made it easier to target different browsers Supported global variables Made it easier to do DRY CSS Simplified complicated style hierarchies
  • 18. LESS for CSS Use LESS to write less CSS Variables, operations, mix-ins, nested rules lesscss.org LESS is CSS
  • 19. What LESS does NOT do Does not… Add CSS support to browsers Detect CSS support in browsers Save you from writing bad CSS Add runtime overhead*
  • 20. Variables Reusable values Can only be defined once Output CSS LESS @nice-blue: #5B83AD; @light-blue: @nice-blue + #111; #header { color: @light-blue; } #header { color: #6c94be; }
  • 21. Operations In-line CSS operations Any number, color, or variable Output CSS LESS @base: 5%; @filler: @base * 2; @other: @base + @filler; @base-color: #C9C9C9; .rule{ color: #888 / 4; background-color: @base-color + #111; height: 100% / 2 + @filler; } .rule { color: #222222; background-color: #dadada; height: 60%; }
  • 22. Mix-ins Encapsulated CSS rule sets Reusable Can accept parameters Output CSS LESS /*LESS Mix-in*/ .border-radius (@radius) { -moz-border-radius: @radius; -webkit-border-radius: @radius; border-radius: @radius; } #header { .border-radius(4px); } #header { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
  • 23. Nested Rules Simplifies complicated CSS rule naming Output CSS LESS #header { color: black; .navigation { font-size: 12px; } .logo { width: 300px; &:hover { text-decoration: none } } } #header { color: black; } #header .navigation { font-size: 12px; } #header .logo { width: 300px; } #header .logo:hover{ text-decoration: none; }
  • 24. Different Ways to Use LESS Dynamic parsing client-side Dynamic parsing server-side ASP.NET Handler Design-time/Building-time parsing Chirpy for VS <link rel="stylesheet/less" href="style.less" type="text/css" /> <script src="http://lesscss.googlecode.com/files/less-1.0.21.min.js"></script>
  • 25.
  • 26. Can you do more with LESS?
  • 27. Your Feedback is Important Please fill out a session evaluation form drop it off at the conference registration desk. Thank you! telerikwatch.com @toddanglin anglin@telerik.com

Hinweis der Redaktion

  1. Wrong answers: -developer job security-make designers feel like programmers
  2. Before CSS:Styles were mixed with HTML tags (difficult to update, difficult to read)Layout was defined with HTML tags (poor semantic use of tags)
  3. CSS exists to separate styling and layout decisions from structural meaning of underlying document*Separation of concerns to a degreeCSS rules often tend to create dependencies on HTMLOther benefits of CSS:Performance (caching of CSS rules)Semantic HTML
  4. http://dzineblog.com/2008/07/20-cool-css-zen-garden-designs.htmlCSS Zen Garden – Example of the flexibility CSS provideshttp://www.csszengarden.com
  5. Key offendersSupporting different versionsIE6 is the devilExamples of needed hacks and workaroundshttp://www.webdevout.net/css-hacks
  6. IE6 is the devil – It is the source of many CSS myths, fears, and painful truths.Microsoft is actively trying to help end the IE6 era – goal: less than 1% usage worldwide.
  7. New CSS3 featuresCSS3 principlesShow example of CSS3 in actionhttp://www.w3.org/Style/CSS/current-workhttp://www.w3.org/TR/2010/WD-css-2010-20101202/#css3
  8. -Show example of browser prefixes in actionhttp://www.w3.org/TR/CSS21/syndata.html#vendor-keywords
  9. Great tutorial:http://designshack.co.uk/articles/css/using-less-js-to-simplify-your-css3LESS site: http://lesscss.org/Logo from http://lesscss.org/
  10. *Depends on how you deploy LESS – runtime conversions of LESS to CSS can have some impact; build-time conversions do not.
  11. JavaScript preprocessorASP.NET Handler - http://www.4guysfromrolla.com/articles/030310-1.aspxVisual Studio tooling – Chirpy - http://chirpy.codeplex.com/
  12. -The pros and cons of using runtime vs. design time LESS to CSS parsing