Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

An Introduction to CSS Frameworks


Published on

This is a basic introduction to CSS Frameworks

Published in: Technology, Education
  • Login to see the comments

An Introduction to CSS Frameworks

  1. 1. CSS Frameworks
  2. 2. Introduction <ul><li>The frustrations with CSS development </li></ul><ul><li>About CSS Frameworks </li></ul><ul><li>Overview of available frameworks </li></ul><ul><li>Advantages </li></ul><ul><li>Case Study – Blueprint </li></ul><ul><li>Case Study – 960gs </li></ul><ul><li>Case Study – CSS Scaffold </li></ul><ul><li>Disadvantages </li></ul><ul><li>Summary </li></ul>
  3. 3. The Frustrations of CSS development <ul><li>Code Reuse </li></ul><ul><ul><li>Too many wheels getting re-invented </li></ul></ul><ul><li>Most CSS development time is spent debugging </li></ul><ul><ul><li>That damn IE6! </li></ul></ul><ul><li>No standards </li></ul><ul><ul><li>We’re not talking W3C here </li></ul></ul><ul><li>Coding takes too long </li></ul><ul><ul><li>Each design is very bespoke to each project </li></ul></ul><ul><li>Very difficult to achieve pixel perfection </li></ul><ul><li>How can we think smarter? </li></ul>
  4. 4. CSS Framework? <ul><li>“ a set of tools, libraries, conventions, and best practices that attempt to abstract routine tasks into generic modules that can be reused. The goal here is to allow the designer or developer to focus on tasks that are unique to a given project, rather than reinventing the wheel each time around” JEFF CROFT , A LIST APART </li></ul>
  5. 5. What’s out there?
  6. 6. Advantages of CSS Frameworks <ul><li>Increase productivity </li></ul><ul><li>Reduce errors </li></ul><ul><li>Consistency of code </li></ul><ul><li>Better team workflow </li></ul><ul><li>Helps to create well structured, browser-compatible code. </li></ul><ul><li>Clean, pixel-perfect designs </li></ul>
  7. 7. <ul><li>Consists of several CSS files: </li></ul><ul><ul><li>reset.css : This file resets CSS values that browsers tend to set for you. </li></ul></ul><ul><ul><li>grid.css : This file sets up the grid (it’s true). It has a lot of classes you apply to divs to set up any sort of column-based grid. </li></ul></ul><ul><ul><li>typography.css : This file sets some default typography. It also has a few methods for some really fancy stuff to do with your text. </li></ul></ul><ul><ul><li>forms.css : Includes some minimal styling of forms. </li></ul></ul><ul><ul><li>print.css : This file sets some default print rules, so that printed versions of your site looks better than they usually would. It should be included on every page. </li></ul></ul><ul><ul><li>ie.css : Includes every hack for our beloved IE6 and 7. </li></ul></ul><ul><li>These files are then compressed and merged into three main files to include in your site: </li></ul><ul><ul><li>screen.css : This is for viewing on screen </li></ul></ul><ul><ul><li>print.css : This is for correct print display </li></ul></ul><ul><ul><li>ie.css : This contains specific IE workarounds </li></ul></ul>
  8. 8. <ul><li>The default grid pattern of Blueprint consists of 24 columns, each of 30px wide and 10px margin. </li></ul><ul><li>Total width of container element is 950px. ((24 * 40)-10) </li></ul><ul><li>Simple HTML syntax </li></ul><ul><ul><li><div class=&quot;container&quot;> </li></ul></ul><ul><ul><ul><li><div class=&quot;span-24 last&quot;> Header </div> </li></ul></ul></ul><ul><ul><ul><li><div class=&quot;span-4&quot;> Left sidebar </div> </li></ul></ul></ul><ul><ul><ul><li><div class=&quot;span-14&quot;> Main content </div> </li></ul></ul></ul><ul><ul><ul><li><div class=&quot;span-4 last&quot;> Right sidebar </div> </li></ul></ul></ul><ul><ul><li></div> </li></ul></ul><ul><li>Modify columns and widths with CSS generators such as (or manually create using ruby script) </li></ul>The grid
  9. 10. 24 column layout main area 17 cols Sidebar 6 cols Main area split into 2 Blocks of 8 cols each
  10. 11. <ul><li>Based on 960 width using either 16 or 12 column variants </li></ul><ul><li>Alternative of 24 column grid also available. </li></ul><ul><li>More obscure class names such as omega and alpha </li></ul><ul><li>Not as mature </li></ul>
  11. 12. <ul><li>Scaffold is a dynamic CSS framework using CSS-like syntax to extend CSS root functionality </li></ul><ul><li>Uses a .htaccess file to redirect queries for CSS files through a PHP processor </li></ul><ul><li>Features include: </li></ul><ul><ul><li>Constants </li></ul></ul><ul><ul><li>Mixins </li></ul></ul><ul><ul><li>Compressed, Cached and Gzipped on-the-fly </li></ul></ul><ul><ul><li>Nested Selectors </li></ul></ul><ul><ul><li>Perform PHP operations </li></ul></ul><ul><ul><li>Image replace text by just linking to the image file </li></ul></ul><ul><ul><li>Plus easily add your own functionality using the plugin system </li></ul></ul>
  12. 13. Constants <ul><li>@constants </li></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>normal_color:#eee; </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>body </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>color:!normal_color; </li></ul></ul><ul><ul><li>} </li></ul></ul>
  13. 14. Expressions <ul><li>#id </li></ul><ul><li>{ </li></ul><ul><li>padding:#[10 * !constant]px; </li></ul><ul><li>} </li></ul>
  14. 15. Iterations <ul><li>@for !i from 1 to 12 </li></ul><ul><li>{ </li></ul><ul><li>.columns-!i { </li></ul><ul><li>width: !ipx; </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
  15. 16. Mixins <ul><li>=box(!color) </li></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>padding:10px; </li></ul></ul><ul><ul><li>border:1px solid !color; </li></ul></ul><ul><ul><li>color:!color; </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>=error </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>+box(red); </li></ul></ul><ul><ul><li>background:red; </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>=alert </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>+error; </li></ul></ul><ul><ul><li>background:yellow; </li></ul></ul><ul><ul><li>} </li></ul></ul>
  16. 17. Disadvantages of Frameworks <ul><li>Not Semantic </li></ul><ul><ul><li><div class=“span-3”>, <div class=“span-19”> </li></ul></ul><ul><ul><li>Ids can be attached </li></ul></ul><ul><li>Bloated code </li></ul><ul><li>Learning curve </li></ul><ul><li>Creates design restrictions </li></ul><ul><li>Written by other people “I don’t like magic. I like knowing how something works. </li></ul><ul><li>I don’t like taking things for granted because if magic breaks, unless it’s your own trick, you don’t know how to fix it.” Sean Inman </li></ul><ul><li>Build your own? </li></ul><ul><ul><li>Lack of support and documentation if developer leaves/on holiday </li></ul></ul><ul><ul><li>Learning curve for other people </li></ul></ul>
  17. 18. Summary <ul><li>CSS Frameworks help by </li></ul><ul><ul><li>Speeding up the development process </li></ul></ul><ul><ul><li>Helping improve designs and final output </li></ul></ul><ul><ul><li>Reduce bugs </li></ul></ul><ul><ul><li>Encourage reuse of code and separation of styles </li></ul></ul><ul><ul><li>If nothing else can be used as a rapid prototyping tool </li></ul></ul><ul><li>CSS Frameworks provide </li></ul><ul><ul><li>Grid based layouts </li></ul></ul><ul><ul><li>Reset, Base, Print, and Typography styles </li></ul></ul><ul><ul><li>Browser-specific bug fixes (IE6) </li></ul></ul><ul><ul><li>Dynamic Content (CSScaffold) </li></ul></ul><ul><li>CSS Frameworks are not perfect </li></ul><ul><ul><li>Unsemantic </li></ul></ul><ul><ul><li>Not your own code </li></ul></ul><ul><ul><li>Could try building your own – has further complications </li></ul></ul>
  18. 19. Resources <ul><li>Blueprint - </li></ul><ul><li>Blueprint showcase – </li></ul><ul><li>960gs and showcase – </li></ul><ul><li>Scaffold – </li></ul><ul><li>Grid design showcase - </li></ul><ul><li>Grid designer – </li></ul>
  19. 20. Questions?