SlideShare une entreprise Scribd logo
1  sur  21
Ankit Shukla
Knoldus Software LLP
Ankit Shukla
Knoldus Software LLP
Less
Topics to be Covered
● About Less
● Variables
● Scope
● Mixins
● Nested Rules
● Namespaces
● Operations
● Functions
● Extend
● Mixin Guards
● Loop
● Parent Selector
About Less
● Less is a CSS pre-processor, meaning that it extends the CSS language, adding
features that allow variables, mixins, functions and many other techniques.
● Developed by Alexis Sellier in 2009.
● The current stable version is 1.7.3
● Inspired by SASS.
●
Variables
● Variables in less are defined with @
● The assignment is done by :
● It stores a constant value.
● Some properties are used many times in our CSS.
It helps to make our code easier to maintain by
giving us way to control the repeated properties
from a single location.
Variables Continues...
Less Code:
@color : #33333;
p{
color : @color;
}
.demo {
background : @color;
}
Output :
p{
color : #333333;
}
.demo{
background : #333333;
}
Scope
@var: red;
#page {
#header {
@var: white;
color: @var; // white
}
color : @var;
}
● Output
#page {
color: #ff0000;
}
#page #header {
color: #ffffff;
}
Mixin
.demo-class{
color : #aaa;
font-size : 20px;
}
.class-A{
.demo-class;
background : #000;
}
Output:
.demo-class {
color: #aaa;
font-size: 20px;
}
.class-A{
color : #aaa;
font-size : 20px;
background : #000;
}
If you do not want that mixin to be output, you can put
parenthesis after it.
.mixin {
color: black;
}
.other-mixin() {
background: white;
}
.class {
.my-mixin;
.other-mixin;
}
Output:
.mixin {
color: black;
}
.class {
color: black;
background: white;
}
Parametric Mixins
.demo-class(@padding){
padding : @padding;
}
.class-A{
.demo-class(5px);
background : #000;
}
.class-B{
.demo-class(8px);
}
Output
.class-A{
padding : 5px;
background : #000;
}
.class-B{
padding : 8px;
}
Nested Rules
#header {
color: #999;
.logo {
width: 300px;
&:hover{
width:350px;
}
}
}
Output:
#header {
color: #999;
}
#header .logo {
width: 300px;
}
#header .logo:hover {
width: 350px;
}
Namespaces
#bundle {
.button {
display: block;
border: 1px solid black;
background-color: grey;
}
}
#header a {
color: orange;
#bundle > .button;
}
● Output
#bundle .button {
display: block;
border: 1px solid black;
background-color: grey;
}
#header a {
color: orange;
display: block;
border: 1px solid black;
background-color: grey;
}
Operations
@base: 5%;
@filler: @base * 2;
@other: @base + @filler;
@base-color : #aaa;
#class{
color: #888 / 4;
background-color: @base-color + #111;
height: 100% / 2 + @filler;
width : @other + 50%;
}
● Output
#class {
color: #222222;
background-color: #bbbbbb;
height: 60%;
width: 65%;
}
Functions
@base: #f04615;
@width: 0.5;
.class {
width: percentage(@width);
color: saturate(@base, 5%);
}
● Output
.class {
width: 50%;
color: #f6430f;
}
Extend
● Extend is a Less Pseudo-Class which merges the
selector it is put on with ones that match what it
references.
● Extend Syntax : .a:extend(.b) {} or
.a { &:extend(.b);}
Extend Continues...
.a {
color : #666;
}
.b:extend(.a){
font-size : 24px ;
}
● Output
.a,
.b {
color: #666;
}
.b {
font-size: 24px ;
}
Extend All
.test.c {
color: orange;
}
.test {
color : #555;
}
.replacement {
&:extend(.test all);
}
● Output
.test.c,
.replacement.c {
color: orange;
}
.test,
.replacement {
color: #555;
}
Mixin Gaurds
.mixin (@a) when (percentage(@a) >=
50%) {
background-color: black;
}
.mixin (@a) when (percentage(@a) < 50%)
{
background-color: white;
}
.mixin (@a) {
width: percentage(@a);
}
.class1 { .mixin(.4) }
.class2 { .mixin(.6) }
● Output
.class1 {
background-color: white;
width: 40%;
}
.class2 {
background-color: black;
width: 60%;
}
Loop
.generate-columns(@n, @i: 1) when
(@i =< @n) {
.column-@{i} {
width: (@i * 100% / @n);
}
.generate-columns(@n, (@i + 1));
}
.generate-columns(2);
● Output
.column-1 {
width: 50%;
}
.column-2 {
width: 100%;
}
Parent Selector
.A {
.B {
&:hover{
color :#222;
}
& & {
color: green;
}
}
}
● Output
.A .B:hover {
color: #222;
}
.A .B .A .B {
color: green;
}
Parent Selector Continues...
.header {
.menu {
border-radius: 5px;
.no-borderradius & {
border : none;
}
}
}
● Output
.header .menu {
border-radius: 5px;
}
.no-borderradius .header .menu {
border: none;
}
Thank You :)

Contenu connexe

Tendances

Workshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsWorkshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsVisual Engineering
 
Web Design Course: CSS lecture 2
Web Design Course: CSS  lecture 2Web Design Course: CSS  lecture 2
Web Design Course: CSS lecture 2Gheyath M. Othman
 
Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3Gheyath M. Othman
 
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4Gheyath M. Othman
 
Web Engineering - Basic CSS Properties
Web Engineering - Basic CSS PropertiesWeb Engineering - Basic CSS Properties
Web Engineering - Basic CSS PropertiesNosheen Qamar
 
Pemrograman Web 3 - CSS Basic Part 2
Pemrograman Web 3 - CSS Basic Part 2Pemrograman Web 3 - CSS Basic Part 2
Pemrograman Web 3 - CSS Basic Part 2Nur Fadli Utomo
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Gheyath M. Othman
 
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship CourseZoltan Iszlai
 
Jekyll - Liquid for noobs
Jekyll - Liquid for noobsJekyll - Liquid for noobs
Jekyll - Liquid for noobsBruno Mendes
 
Compile your Style
Compile your StyleCompile your Style
Compile your StyleRagnar Kurm
 
Forms and Databases in PHP
Forms and Databases in PHPForms and Databases in PHP
Forms and Databases in PHPMike Crabb
 
My 70-480 HTML5 certification learning
My 70-480 HTML5 certification learningMy 70-480 HTML5 certification learning
My 70-480 HTML5 certification learningSyed Irtaza Ali
 

Tendances (20)

Workshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsWorkshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effects
 
Web Design Course: CSS lecture 2
Web Design Course: CSS  lecture 2Web Design Course: CSS  lecture 2
Web Design Course: CSS lecture 2
 
Workshop 6: Designer tools
Workshop 6: Designer toolsWorkshop 6: Designer tools
Workshop 6: Designer tools
 
Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3
 
Css web side
Css web sideCss web side
Css web side
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4
 
Taming CSS Selectors
Taming CSS SelectorsTaming CSS Selectors
Taming CSS Selectors
 
Web Engineering - Basic CSS Properties
Web Engineering - Basic CSS PropertiesWeb Engineering - Basic CSS Properties
Web Engineering - Basic CSS Properties
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Getting started with css
Getting started with cssGetting started with css
Getting started with css
 
Pemrograman Web 3 - CSS Basic Part 2
Pemrograman Web 3 - CSS Basic Part 2Pemrograman Web 3 - CSS Basic Part 2
Pemrograman Web 3 - CSS Basic Part 2
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1
 
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
 
Jekyll - Liquid for noobs
Jekyll - Liquid for noobsJekyll - Liquid for noobs
Jekyll - Liquid for noobs
 
Compile your Style
Compile your StyleCompile your Style
Compile your Style
 
CSS3 Refresher
CSS3 RefresherCSS3 Refresher
CSS3 Refresher
 
Forms and Databases in PHP
Forms and Databases in PHPForms and Databases in PHP
Forms and Databases in PHP
 
Landing Pages 101
Landing Pages 101Landing Pages 101
Landing Pages 101
 
My 70-480 HTML5 certification learning
My 70-480 HTML5 certification learningMy 70-480 HTML5 certification learning
My 70-480 HTML5 certification learning
 

En vedette

En vedette (6)

GulpJs - An Introduction
GulpJs - An IntroductionGulpJs - An Introduction
GulpJs - An Introduction
 
Scala oo
Scala ooScala oo
Scala oo
 
Scala idioms
Scala idiomsScala idioms
Scala idioms
 
Backbone js
Backbone jsBackbone js
Backbone js
 
Scala parallel-collections
Scala parallel-collectionsScala parallel-collections
Scala parallel-collections
 
Backbonejs
BackbonejsBackbonejs
Backbonejs
 

Similaire à Introduction To Less

LeSS in action
LeSS in actionLeSS in action
LeSS in actionPu Shiming
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESSjsmith92
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With LessDavid Engel
 
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
 
Degrafa Top 5 Features
Degrafa Top 5 FeaturesDegrafa Top 5 Features
Degrafa Top 5 FeaturesJuan Sanchez
 
Agile CSS development with Compass and Sass
Agile CSS development with Compass and SassAgile CSS development with Compass and Sass
Agile CSS development with Compass and SassAndrea Verlicchi
 
LESS is More
LESS is MoreLESS is More
LESS is Morejsmith92
 
UI Realigning & Refactoring by Jina Bolton
UI Realigning & Refactoring by Jina BoltonUI Realigning & Refactoring by Jina Bolton
UI Realigning & Refactoring by Jina BoltonCodemotion
 
Coder Presentation Boston
Coder Presentation BostonCoder Presentation Boston
Coder Presentation BostonDoug Green
 
Write LESS. DO more.
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.Eugene Nor
 
End-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptEnd-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptGil Fink
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James NelsonGWTcon
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATIONkrutitrivedi
 
Linux Shell Scripting Craftsmanship
Linux Shell Scripting CraftsmanshipLinux Shell Scripting Craftsmanship
Linux Shell Scripting Craftsmanshipbokonen
 
Intro to React
Intro to ReactIntro to React
Intro to ReactTroy Miles
 
Building End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScriptBuilding End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScriptGil Fink
 

Similaire à Introduction To Less (20)

LeSS in action
LeSS in actionLeSS in action
LeSS in action
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESS
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
 
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
 
Degrafa Top 5 Features
Degrafa Top 5 FeaturesDegrafa Top 5 Features
Degrafa Top 5 Features
 
Agile CSS development with Compass and Sass
Agile CSS development with Compass and SassAgile CSS development with Compass and Sass
Agile CSS development with Compass and Sass
 
LESS is More
LESS is MoreLESS is More
LESS is More
 
UI Realigning & Refactoring by Jina Bolton
UI Realigning & Refactoring by Jina BoltonUI Realigning & Refactoring by Jina Bolton
UI Realigning & Refactoring by Jina Bolton
 
Coder Presentation Boston
Coder Presentation BostonCoder Presentation Boston
Coder Presentation Boston
 
Write LESS. DO more.
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.
 
CSS3
CSS3CSS3
CSS3
 
Php
PhpPhp
Php
 
End-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptEnd-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScript
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATION
 
Linux Shell Scripting Craftsmanship
Linux Shell Scripting CraftsmanshipLinux Shell Scripting Craftsmanship
Linux Shell Scripting Craftsmanship
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Oops lecture 1
Oops lecture 1Oops lecture 1
Oops lecture 1
 
Building End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScriptBuilding End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScript
 
Sass Essentials
Sass EssentialsSass Essentials
Sass Essentials
 

Plus de Knoldus Inc.

Supply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptxSupply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptxKnoldus Inc.
 
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingKnoldus Inc.
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionKnoldus Inc.
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxKnoldus Inc.
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptxKnoldus Inc.
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfKnoldus Inc.
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxKnoldus Inc.
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingKnoldus Inc.
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesKnoldus Inc.
 
Introduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxIntroduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxKnoldus Inc.
 
Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxKnoldus Inc.
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxKnoldus Inc.
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxKnoldus Inc.
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxKnoldus Inc.
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationKnoldus Inc.
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationKnoldus Inc.
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIsKnoldus Inc.
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II PresentationKnoldus Inc.
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAKnoldus Inc.
 

Plus de Knoldus Inc. (20)

Supply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptxSupply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptx
 
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On Introduction
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptx
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptx
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdf
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptx
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable Testing
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose Kubernetes
 
Introduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxIntroduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptx
 
Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptx
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptx
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptx
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptx
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake Presentation
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics Presentation
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIs
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II Presentation
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRA
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
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 RobisonAnna Loughnan Colquhoun
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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 FresherRemote DBA Services
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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 WoodJuan lago vázquez
 
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...apidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
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 2024The Digital Insurer
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
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...apidays
 
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...DianaGray10
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Dernier (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
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...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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...
 
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...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

Introduction To Less

  • 1. Ankit Shukla Knoldus Software LLP Ankit Shukla Knoldus Software LLP Less
  • 2. Topics to be Covered ● About Less ● Variables ● Scope ● Mixins ● Nested Rules ● Namespaces ● Operations ● Functions ● Extend ● Mixin Guards ● Loop ● Parent Selector
  • 3. About Less ● Less is a CSS pre-processor, meaning that it extends the CSS language, adding features that allow variables, mixins, functions and many other techniques. ● Developed by Alexis Sellier in 2009. ● The current stable version is 1.7.3 ● Inspired by SASS. ●
  • 4. Variables ● Variables in less are defined with @ ● The assignment is done by : ● It stores a constant value. ● Some properties are used many times in our CSS. It helps to make our code easier to maintain by giving us way to control the repeated properties from a single location.
  • 5. Variables Continues... Less Code: @color : #33333; p{ color : @color; } .demo { background : @color; } Output : p{ color : #333333; } .demo{ background : #333333; }
  • 6. Scope @var: red; #page { #header { @var: white; color: @var; // white } color : @var; } ● Output #page { color: #ff0000; } #page #header { color: #ffffff; }
  • 7. Mixin .demo-class{ color : #aaa; font-size : 20px; } .class-A{ .demo-class; background : #000; } Output: .demo-class { color: #aaa; font-size: 20px; } .class-A{ color : #aaa; font-size : 20px; background : #000; }
  • 8. If you do not want that mixin to be output, you can put parenthesis after it. .mixin { color: black; } .other-mixin() { background: white; } .class { .my-mixin; .other-mixin; } Output: .mixin { color: black; } .class { color: black; background: white; }
  • 9. Parametric Mixins .demo-class(@padding){ padding : @padding; } .class-A{ .demo-class(5px); background : #000; } .class-B{ .demo-class(8px); } Output .class-A{ padding : 5px; background : #000; } .class-B{ padding : 8px; }
  • 10. Nested Rules #header { color: #999; .logo { width: 300px; &:hover{ width:350px; } } } Output: #header { color: #999; } #header .logo { width: 300px; } #header .logo:hover { width: 350px; }
  • 11. Namespaces #bundle { .button { display: block; border: 1px solid black; background-color: grey; } } #header a { color: orange; #bundle > .button; } ● Output #bundle .button { display: block; border: 1px solid black; background-color: grey; } #header a { color: orange; display: block; border: 1px solid black; background-color: grey; }
  • 12. Operations @base: 5%; @filler: @base * 2; @other: @base + @filler; @base-color : #aaa; #class{ color: #888 / 4; background-color: @base-color + #111; height: 100% / 2 + @filler; width : @other + 50%; } ● Output #class { color: #222222; background-color: #bbbbbb; height: 60%; width: 65%; }
  • 13. Functions @base: #f04615; @width: 0.5; .class { width: percentage(@width); color: saturate(@base, 5%); } ● Output .class { width: 50%; color: #f6430f; }
  • 14. Extend ● Extend is a Less Pseudo-Class which merges the selector it is put on with ones that match what it references. ● Extend Syntax : .a:extend(.b) {} or .a { &:extend(.b);}
  • 15. Extend Continues... .a { color : #666; } .b:extend(.a){ font-size : 24px ; } ● Output .a, .b { color: #666; } .b { font-size: 24px ; }
  • 16. Extend All .test.c { color: orange; } .test { color : #555; } .replacement { &:extend(.test all); } ● Output .test.c, .replacement.c { color: orange; } .test, .replacement { color: #555; }
  • 17. Mixin Gaurds .mixin (@a) when (percentage(@a) >= 50%) { background-color: black; } .mixin (@a) when (percentage(@a) < 50%) { background-color: white; } .mixin (@a) { width: percentage(@a); } .class1 { .mixin(.4) } .class2 { .mixin(.6) } ● Output .class1 { background-color: white; width: 40%; } .class2 { background-color: black; width: 60%; }
  • 18. Loop .generate-columns(@n, @i: 1) when (@i =< @n) { .column-@{i} { width: (@i * 100% / @n); } .generate-columns(@n, (@i + 1)); } .generate-columns(2); ● Output .column-1 { width: 50%; } .column-2 { width: 100%; }
  • 19. Parent Selector .A { .B { &:hover{ color :#222; } & & { color: green; } } } ● Output .A .B:hover { color: #222; } .A .B .A .B { color: green; }
  • 20. Parent Selector Continues... .header { .menu { border-radius: 5px; .no-borderradius & { border : none; } } } ● Output .header .menu { border-radius: 5px; } .no-borderradius .header .menu { border: none; }