Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Less_css_介绍.pdf
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
sokamal
July 14, 2013
Programming
78
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Less_css_介绍.pdf
sokamal
July 14, 2013
Transcript
18 slides
LESS CSS 介绍 ECD kamalyu
Index • 语法介绍 • 1.4.0 Beta 新特性 • 优缺点 •
怎样使用 • 其它
语法介绍-变量 LESS 编译后
语法介绍-混合 LESS 编译后
语法介绍-混合(带参数) LESS 编译后
语法介绍-混合(带参数) LESS 编译后 稍后阅读:@arguments 变量;高级参数用法与 @rest 变量;
语法介绍-继承 LESS 编译后 稍后阅读:& 的高级用法;@extend 继承用法(Beta);
语法介绍-运算 LESS 编译后
语法介绍-函数 LESS 提供了多种函数 用于控制颜色变化、处理字符串、算术运算等等。 稍后阅读:LESS内置函数;
语法介绍-作用域 LESS 编译后 与其它编程语言类似 先从本地模块中查找变量或者混合模块, 没找到的话就去父级作用域中查找,直到找到为止。
语法介绍-注释 LESS 编译后 /* CSS风格的注释解析后会保留 */ //双斜线的注释会自动过滤
语法介绍-禁止编译 LESS 编译后 需要输出不标准的CSS语法的时候 在字符串前加上一个 ~, 用“”把避免直接编译的值包裹起来, 用反斜杠 \ 转意引号
语法介绍-Importing 可以通过以下两种方式导入 LESS 文件 也可以导入CSS文件 @import-once 只导入一次,LESS 1.4.0 以上默认执行 @import-once
语法介绍-1.4.0 Beta import 解析后
LESS 优缺点 1. 变量,多处使用的内容取一个有意义的名字,不止是方便修改 2. 浏览器前缀不再是问题 3. 嵌套写法 LESS 的优点
LESS 的缺点 1. 重复定义,文件快速膨胀【1.4.0 会引入 @extend .mixins; 可以部分解决这个问题】 2. 维护,需要修改LESS文件,而不是编译后的CSS文件【组内统一思想】 3. 高耦合,谨慎修改基类【良好的编码习惯,模块化代码】 4. 嵌套,容易写出非常长的嵌套规则【良好的编码习惯】 5. 调试,默认编译后的CSS是压缩过的【配置IDE不压缩】
怎样使LESS 如果用的是 Intellij IDE : 1. 下载这个插件 LESS CSS Compiler;
2. File -> Settings -> Plugins -> Install plugin from disk; 3. FIle -> Settings -> LESS Profiles, 配置 LESS 文件路径和输出的 CSS 文件路径, 这 里可以选择是否压缩CSS文件。 其他编辑器请 Google 之。
延伸阅读 官网: http://www.lesscss.org 官网中文克隆: http://www.lesscss.net LESS on Github:https://github.com/less 使用后的思考: the
problem with css pre processors my thoughts on less
Thanks ECD kamalyu
More Decks by sokamal
See All by sokamal
RETINA时代的前端优化
ikamal
2
200
亚马逊的快速菜单
ikamal
1
130
jQuery最佳实践
ikamal
1
110
Other Decks in Programming
See All in Programming
Distance field of Julia set
kinakomoti321
0
330
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
180
AI Augmentation Techniques with Liberty
ivargrimstad
1
560
AIがコードを書いてくれる時代、我々は何を確かめるのか
yosuke_furukawa
PRO
13
6.2k
Getting Started with Vibe Coding
miccheng
0
250
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
810
Going Full Circle with Virtual Graphs and Relational Databases
michaelsimons
1
110
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
670
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
150
マルチプロダクトSaaSの アプリ一覧を速くする——複数プロダクトにまたがる「権限行脚」を減らすまで #techramen26conf
mktakuya
1
180
AppFunctionsの内部実装を紐解く
hiroaki404
0
120
Engineering Biometric UX Across Android Versions | DroidKnights 2026
ryunen344
1
220
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
620
Build your cross-platform service in a week with App Engine
jlugia
234
19k
The SEO identity crisis: Don't let AI make you average
varn
0
630
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
340
The browser strikes back
jonoalderson
0
2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
It's Worth the Effort
3n
188
29k
RailsConf 2023
tenderlove
30
1.6k