Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Avoiding the Threat of Awful CSS

Avoiding the Threat of Awful CSS

CSS: the very acronym sends shivers down the spine of the most hardened Web design veterans. Even for master pixel pushers who have worked with CSS for years, style sheets can quickly become unruly, unfriendly, and unmaintainable. In this session, you'll find out how to make your CSS more developer-friendly: we'll discuss patterns to cut down on duplication while maintaining flexibility and review whether CSS preprocessors are right for you and your project. All skill levels are welcome!

timgthomas

June 09, 2012
Tweet

More Decks by timgthomas

Other Decks in Technology

Transcript

  1. Layouts in CSS .l-navigation { /* ... */ } .l-hero

    { /* ... */ } .l-featured { /* ... */ } .l-legal { /* ... */ }
  2. Modules in CSS .featured-list { /* ... */ } .featured-list

    .title { /* ... */ } .featured-list .item { /* ... */ }
  3. Flexible Selectors: Short header > h1 #main .date span >

    em { /* Yuck. */ } .meaningful { /* Yum! */ }
  4. Flexible Selectors: Elements nav { /* ... */ } button

    { /* ... */ } input { /* ... */ } aside { /* ... */ }
  5. Logical Groups .green-border { /* Boo! Hiss! */ border: 1px

    solid #0f0; } .user-selected { /* Yay! */ border: 1px solid #f0f; }
  6. Preprocessors Turn This… .cohesive-group-a { border: 1px solid #f0f; color:

    #00f; font: 1.2em/2.4em Comic Sans; } .cohesive-group-b { border: 1px solid #f0f; color: #f00; font: 1.2em/2.4em Comic Sans; }
  7. …Into This: .shared-styles { border: 1px solid #f0f; font: 1.2em/2.4em

    Comic Sans; } .cohesive-group-a { .shared-styles(); color: #00f; } .cohesive-group-b { .shared-styles(); color: #f00; }
  8. Other Cool Stu#: Vendor Pre$xes! .scale(scale-amount) { -webkit-transform: scale(scale-amount); -moz-transform:

    scale(scale-amount); -ms-transform: scale(scale-amount); -o-transform: scale(scale-amount); transform: scale(scale-amount); }