Anúncio

Cascading Style Sheets - Part 02

Principal Project Manager em Microsoft
27 de Jan de 2009
Anúncio

Mais conteúdo relacionado

Anúncio

Cascading Style Sheets - Part 02

  1. Cascading Style Sheets Hatem Mahmoud [email_address]
  2. Part 2
  3. Quick Review
  4. I don't hate Microsoft
  5. Need for Guidelines
  6. How?
  7. 1) Establish a set of rules
  8. 2) Document those rules
  9. 3) Enforce their use
  10. Thank You!
  11. wait
  12. General Guidelines
  13. Respect major browsers IE 6+ Firefox 2+ Safari 3+
  14. Don't ignore IE 6
  15. IE7.js A JavaScript library to make Microsoft Internet Explorer (5, 6, 7) behave like a standards-compliant browser. http://code.google.com/p/ie7-js/
  16. IE7.js
  17. Use semantic markup
  18. Do not use tables for layout, they were made for tabular data
  19.  
  20.  
  21. Always use Web-safe fonts (Common fonts to all versions of Windows and Mac)
  22. When possible, use transparent GIFs instead of transparent PNGs
  23. Never resize images in CSS or HTML, they would look ugly
  24. Make your site accessible and usable for all users and devices
  25. Validate your markup http://validator.w3.org/
  26. Validate your CSS http://jigsaw.w3.org/css-validator/
  27. CSS Guidelines
  28. Avoid inline styles
  29. Avoid fancy CSS3 selectors
  30. Compress your CSS http://www.cssdrive.com/
  31. Coding Tips
  32. Organize your CSS
  33. How?
  34. Use a framework typography.css, grid.css, layout.css, form.css, etc.
  35.  
  36. Or design your own
  37. Why?
  38. CSS Reset
  39. Solution?
  40. Begin with a few default styles
  41. Keep a library of helpful classes
  42. Techniques
  43. Avoid CSS Hacks!
  44. Box Model Bug
  45. Targeting different media types
  46. <link type=&quot;text/css&quot; href=&quot;screen.css&quot; media=&quot; screen &quot; />
  47.  
  48. <link type=&quot;text/css&quot; href=&quot;print.css&quot; media=&quot; print &quot; />
  49.  
  50. Supported values: all , aural , braille , embossed , handheld , print , projection , screen , tty , tv
  51. Default value: all
  52. Alternative Style Sheets
  53. A document can link to multiple style sheets
  54. You can give it a default style and any number of alternatives for the user to choose from
  55. How to choose one?
  56. Some browsers support it
  57. Alternative Style Sheets
  58. Some browsers don't ;)
  59. How to create them?
  60. Using the right rel and title attributes
  61. 1) Persistent style sheets
  62. Linked without a title attribute and always applied
  63. <link type=&quot;text/css&quot; href=&quot;main.css&quot; rel=&quot;stylesheet&quot; /> Persistent style sheets
  64. Persistent style sheets
  65. 2) Preferred style sheets
  66. Linked with a title attribute and selected by default
  67. <link type=&quot;text/css&quot; href=&quot;green.css&quot; rel=&quot;stylesheet&quot; title=&quot; Green &quot; /> Preferred style sheets
  68. Preferred style sheets
  69. 3) Alternate style sheets
  70. Linked with a title attribute, and the rel attribute should be set to “ alternate stylesheet “
  71. <link type=&quot;text/css&quot; href=&quot;orange.css&quot; rel=&quot;alternate stylesheet&quot; title=&quot; Orange &quot; /> Alternate style sheets
  72. Alternate style sheets
  73. Not cross-browser?
  74. Use JavaScript
  75. Alternative Style Sheets
  76. Floating
  77. Floating
  78. Example
  79. Floating
  80. Overlapping
  81. Unhappy?
  82. Clear it!
  83. OR
  84. Clearing
  85. Still unhappy?
  86. Clearing
  87. Or, better ...
  88. Clearing
  89. If you get scroll bars...
  90. Clearing
  91. Do this...
  92. To get this...
  93. Clearing
  94. Still unhappy?
  95. Play Solitaire!
  96. Multiple floats
  97. Multiple floats
  98. Clearing
  99. Multiple floats
  100. Fonts
  101. A browser can only display the fonts that are installed on its machine.
  102. Firefox bug!
  103. Firefox resizes heading elements when you specify a font size for the container
  104. Solution
  105. Always specify font size for heading elements (h1, h2, .., h6)
  106. Form elements don't inherit font properties, enforce them to do so
  107. Using em
  108. Why?
  109. Still want to think in pixels?
  110. Solution http://www.clagnut.com
  111. But remember, em is relative
  112. Discussion
  113. Example
  114. Example
  115. Example
  116. Example
  117. The End
  118. References
  119. Thank You! tadsessions.espace.com.eg Hatem Mahmoud [email_address]
Anúncio