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
pro css
Search
xuyannan
January 06, 2013
Technology
170
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
pro css
how to improve our css skills
xuyannan
January 06, 2013
Transcript
34 slides
PRO CSS 2012.12.19 13年1月6⽇日星期⽇日
专业和非专业的区别 13年1月6⽇日星期⽇日
目的是要让大家可以区 分什么是好的,什么是 不好的。 如何写出好的 css 13年1月6⽇日星期⽇日
cೂޅิۚ$44ඣ c$44ࡏܒ 13年1月6⽇日星期⽇日
1.Don’t rush you code and keep it simple 13年1月6⽇日星期⽇日
cೂޅಀൌགྷĤ c֥Ϸم൞ቋႪ֥ગĤ cႵљ֥ϷمગĤ cೂޅಀႪ߄Ĥ 13年1月6⽇日星期⽇日
ᅧࠎЧᆩ്ࠣె 13年1月6⽇日星期⽇日
%3: 对于其他语⾔言来说,可以通 过函数(function)之类的东东 来避免重⽤用, ⽽而在CSS⾥里, 可以通过编写可复⽤用的类 (class)来做到这⼀一点。不过有 时,通过简单的重构 (refactoring)就可以实现 13年1月6⽇日星期⽇日
.navigation li {color: #333;} .navigation li a {color: #333;} /*refatcoring
重构如下:*/ .navigation li, .navigation li a { color: #333; } 13年1月6⽇日星期⽇日
4.OOCSS 13年1月6⽇日星期⽇日
ଢѓğิིۚੱބॖົྟ ൌགྷğ ࢲܒაຓܴٳ ಸఖაଽಸٳ ఙႨ*%࿊ᄴఖ Y 13年1月6⽇日星期⽇日
#my-button, .my-box, .my-box img { border: 1px solid #444; border-radius:
5px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); } .skin { border: 1px solid #444; border-radius: 5px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); } 13年1月6⽇日星期⽇日
#main h2 { color: #343434; font-size: 25px; line-height: 20px; ...
} 13年1月6⽇日星期⽇日
5.CSS3 13年1月6⽇日星期⽇日
c ᄸહҌିൌགྷᆃ۱ིݔĤ c ݺ֥đᆩ֡ᅇϷਔbᆃᇕٚم൞DTTॖၛൌགྷ֥હĤ c ॖၛđܣ൙ࢲඏ c ҂ॖၛđࣉྛֻ҄ c ᛍফఖ֥ᆦӻ౦ঃೂޅĤ
c (PPEđཬၩනđܣ൙ࢲඏb c ҂ݺđࣉྛֻ҄ c ᆃᇕིݔđࣇࣇ൞ุဒ֥ิശđߎ൞ܱۿି c ࣇࣇ൞ุဒ֥ิശğؓႿ҂ᆦӻ֥ᛍফఖ҂ቓԩđࠇᆀ۳ԛ၂۱߭ ٚσ GBMMCBDL c ൞ܱۿିđࣉྛֻ҄ c ପીљ֥Ϸمਔđсྶေᅳ֞ࢳथ֥ٚم 13年1月6⽇日星期⽇日
DEMO 13年1月6⽇日星期⽇日
13年1月6⽇日星期⽇日
ᇯ҄ิശაႪࢆࠩ 13年1月6⽇日星期⽇日
其他 • CSS预处理器 • 关注未来 • 阅读其他⼈人的代码 • 不断实践 13年1月6⽇日星期⽇日
$44ࡏܒ 13年1月6⽇日星期⽇日
cॖყྟ cॖᇗႨྟ cॖົྟ cॖঔᅚྟ ݺࡏܒ 13年1月6⽇日星期⽇日
༵টुुّ૫࢝ҋ 13年1月6⽇日星期⽇日
ࠎႿڳჭটྩڿቆࡱ֥ဢൔ .widget { background: yellow; border: 1px solid black; color:
black; width: 50%; } #sidebar .widget { width: 200px; } body.homepage .widget { background: white; } 13年1月6⽇日星期⽇日
ݖႿگᄖ֥࿊ᄴఖ #main-nav ul li ul li div { } #content
article h1:first-child { } #sidebar > div > h3 + p { } 13年1月6⽇日星期⽇日
ݖႿ௴๙ ၞᇗ ֥DMBTTӫ <div class="widget"> <h3 class="title">...</h3> <div class="contents"> Lorem
ipsum dolor sit amet, consectetur adipiscing elit. Vivamus elementum accumsan dignissim. <button class="action">Click Me!</button> </div> </div> .widget {} .widget .title {} .widget .contents {} .widget .action {} 13年1月6⽇日星期⽇日
၂่ܿᄵቓݖ؟֥൙౦ .widget { position: absolute; top: 20px; left: 20px; background-color:
red; font-size: 1.5em; text-transform: uppercase; } 13年1月6⽇日星期⽇日
ᄜটुुቋࡄൌ 13年1月6⽇日星期⽇日
ܿхԊ /* Grenade */ #main-nav ul li ul { }
/* Sniper Rifle */ .subnav { } 13年1月6⽇日星期⽇日
ٳطᇍᆭ ҃अބק໊ႋھႮః৫֥҃अဢൔ ࠇ৫֥ಸఖটڵᄳ 13年1月6⽇日星期⽇日
ଁॢࡗ /* High risk of style cross-contamination */ .widget {
} .widget .title { } /* Low risk of style cross-contamination */ .widget { } .widget-title { } 13年1月6⽇日星期⽇日
DTTࢲܒ۷Ⴕઆࠠྟ ࠎԤো CBTF ҃अ MBZPVU ଆॶ NPEVMFT ሑ TUBUF 13年1月6⽇日星期⽇日
ႨDMBTTটקၬဢൔđࣇࣇ൞ קၬဢൔ js-* support-* 13年1月6⽇日星期⽇日
۷Ⴕઆࠠྟ֥ଁ /* A component */ .button-group { } /* A
component modifier (modifying .button) */ .button--primary { } /* A component sub-object (lives within .button) */ .button__icon { } /* A layout class */ .l-header { } 13年1月6⽇日星期⽇日
BE PRO thanks 13年1月6⽇日星期⽇日
Other Decks in Technology
See All in Technology
AIエージェントの認証がまとめて進化! ~pre:Inventで来た3つのアップデート~
minorun365
PRO
0
140
コーディングできない僕にBobが舞い降りた
shumpei3
0
240
PMの私の 最近のAgent Skills活用法
haru860
0
110
Platform Engineering をベースとした Agentic Software Factory の実践
110y
3
1.1k
40以上のマイクロサービスを支えるKubernetes JITアクセス — 160以上の恒久RoleBindingを削減
jumpe1
0
120
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
5.5k
AWS Well-Arhitected Frameworkセキュリティの柱 について
miu_crescent
PRO
2
270
【Oracle AI SPOTLIGHT ウェビナー】AI時代、狙われるデータと止められない業務をどう守るか?
oracle4engineer
PRO
1
170
正しくWeb サイトを守るためのコンテンツセキュリティーポリシー
hinalin
0
850
デザインシステムのフィードバックループをほぼ自動化した話
tongari07
1
1.4k
ワークフローからハーネスへ — Web フレームワークの作者たちが AI エージェントに向かう理由
azukiazusa1
4
3.9k
技術書典で本を売る流れ
yoshimura_datam
0
210
Featured
See All Featured
First, design no harm
axbom
PRO
2
1.4k
Rails Girls Zürich Keynote
gr2m
96
14k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Utilizing Notion as your number one productivity tool
mfonobong
4
710
The browser strikes back
jonoalderson
0
2k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
710
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
69k
A better future with KSS
kneath
240
18k
GitHub's CSS Performance
jonrohan
1033
470k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.3k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
1
320