CSS is a very funny language. That is something we all have realised at some point or the other while working with it. If not used correctly, a language used to make things look good can itself start looking bad and we can end up with CSS that is hard to manage and extend. This talk is about 10 things which I have learnt from experience can make one’s CSS manageable and easy to extend, specially in large scale applications.
2. /me
My name is . Better know as on
the web.
Kushagra Gour chinchang
I am from
Delhi, India
3. /me more
I am a Front-end developer at a wonderful startup called
Wingify.
Open-source stuff like andHint.css piCSSel-art.
4. Whats this talk about?
Some CSS goodies learnt from experience.
Would help in better CSS architecture. Easy to understand
and extend in future. No more
Careless Style Sprinkling.
First time speaking at a conference and that too at such a
big one. Not really good at speaking & making
presentations.
// TODO: Add a game if slides don't complete.
Good at making games. Added a game we can all play
together and have fun! Seriously!
6. Keep File Sizes Small
Why?
It helps keeping things modular.
Important for faster search in future because you know
where things are when something needs to be changed.
What?
Keep dividing and refactoring files as and when they get too
big.
26. Naming Convention
Most important thing in CSS. Much more important than
any other languauge.
Some things are bad in CSS (ahem...!important) and can
be eliminated through better naming.
34. z-index Management
Separate them out into your config as variables
$z-index-overlay: 1;
$z-index-slideout-backdrop: 1;
$z-index-slideout: 1;
$z-index-sidebar: 2; // above help panel for tooltips
$z-index-navigation: 4; // top of sidebar
$z-index-header: 4;
$z-index-modal-underlay: 4; // Below modal-box & top of
$z-index-modal-box: 5; // on top of everything
35. z-index Management
Changing existing z-indexes become really easy because
you know what might break.
Setting z-index for new UI elements is very easy because
you can actually position it in a similar hierarchy.