simplifying css selectors
TRANSCRIPT
Agenda:
I CSS Performance Tips
I Types of Selectors
I The Key to E�cient CSS Selectors
I CSS Selector Performance
”Question all usages of
I Adjacent sibling selectors
I Attribute selectors
I Child -> selectors
I Descendant selectors
”Don’t overqualify ID and class
selectors
I span#currency -> #currency
I li.chapter -> .list-chapter
Universal *
Descender div div div p a.link
Child div > div > div > p > a.link
Class .link
Tag a
ID a#goBack
ID #goBack(worst to best)
Web site CSS rule DOM element DOM Depth
AOL 2289 1628 13eBay 305 588 14Facebook 2882 1966 17Google 92 552 8Live Search 376 449 12MSN 1038 886 11MySpace 932 444 9Wikipedia 795 1333 10Yahoo! 800 564 13YouTube 821 817 9Average 1033 923 12
Go Deeper:
I https: // developer. mozilla. org/ en-US/ docs/ Web/ Guide/ CSS/
Writing_ efficient_ CSS
I http: // stevesouders. com/ efws/ css-selectors/ csscreate. php
I http: // csstriggers. com
That’s all Folks!
@barisaydinoglugithub.com/barisaydinoglu