Modular CSS

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

9 comments

Comments 1 - 9 of 9 previous next Post a comment

  • + guest47ba0b guest47ba0b 6 months ago
    Greart!
    I’ve been thinking about separating CSS for a large project from few days. Before starting it from scratch, I was just looking around to see how people are managing/organizing their css. And found this cool slide. It surely help me a lot.
    Thanks to Maxdesign.
  • + shereejp shereejp 8 months ago
    Good work...nice...
  • + ayub ayub 8 months ago
    Wow best article on CSS.
    Great work
  • + guestec1cf guestec1cf 12 months ago
    very nice..............
  • + evandro.net evandro.net 2 years ago
    Very nice!

  • + maxdesign Russ Weakley 3 years ago
    @valicac: The first series of slides talk about web standards (valid, semantic, accessible, separated markup). However, no matter how 'web standards' compliant you make your pages, there still may be times when you have to deal with browser issues. These slides show how you can deal with these issues without compromising web standards - using a few simple 'work arounds'.

    The multiple css files are used for a different reason - they are used to make the CSS more manageable. For large sites, they assist with maintenace.
  • + valicac Ecaterina Valica 3 years ago
    tip: designing with web standards, then you don’t need to create multiple css files, browser specific
  • + maxdesign Russ Weakley 3 years ago
    I agree Mikelward, and have used it on sites where I have felt it is needed - one example where min and max widths were considered important.

    However, for simple layout isues, I prefer to use a simple conditional comment rather than having to force-change IE’s behaviour with JavaScript.

    Thanks :)
    Russ
  • + mikelward mikelward 3 years ago
    The IE7 script by Dean Edwards can be quite useful. It fixes a number of problems with the Internet Explorer box model and adds support for fixed positioning, meaning you’re less likely to need an IE-specific style sheet.

    http://dean.edwards.name/IE7/
Post a comment
Embed Video
Edit your comment Cancel

125 Favorites & 5 Groups

Modular CSS - Presentation Transcript

    • Modular CSS
    • Creating flexible, hack-free and browser-stable CSS
      • Russ Weakley, Max Design
  1. Anyone here build websites ?
  2. OK… let’s assume you’re building a new site
  3. and… let’s assume you’ve done all the right things…
  4. so… your markup is valid
  5. What does this mean? You’ve checked your web documents against a formal standard).
  6. your markup is semantic
  7. What does this mean? You have used appropriate HTML elements to give your content meaning.
  8. your markup is accessible
  9. What does this mean? Your site can be navigated & read by everyone, regardless of disability, location, experience or technology.
  10. your markup is separated
  11. What does this mean? You’ve removed behaviour and presentation from the markup.
  12. and of course, your site fails gracefully
  13. What does this mean? Your site fails so that it continues to operate for lower end users.
  14. Basically, you’re feeling good !
  15. however…
  16. You’re about to face some horrid problems
  17. Mainly to do with browsers and bugs
  18. So, who are the main offenders ?
  19. Offender 1 Windows Internet Explorer 5, 5.5 and 6
  20. Offender 2 Macintosh Internet Explorer 5
  21. Offender 3 Old browsers like Internet Explorer 4 and Netscape 4
  22. on top of that…
  23. You have to make some important decisions
  24. Will you use hacks to overcome these browser bugs?
  25. Will your CSS be maintainable into the future?
  26. Will you be able to manage your CSS across a growing site?
  27. is there a solution?
  28. The solution may be modular CSS
  29. what is it?
  30. A system for managing your CSS
  31. … developed over time
  32. … after lots of tears
  33. how does it work?
  34. Step 1 Build your HTML HTML file
  35. Step 2 Build your CSS HTML file Master CSS file
  36. /* container styles */ #container { } /* header styles */ #header { } #header h1 { } /* content styles */ #content { } #content h2 { } /* footer styles */ #footer { } #footer p { } Master CSS file
  37. Step 3 Separate your CSS HTML file container.css header.css content.css
  38. #container { } #header { } #header h1 { } #content { } #content h2 { } #footer { } #footer p { } New CSS files container styles header styles content styles footer styles
  39. Question Why separate CSS files? • Easier to find rules • More than one developer at a time • Files can be turned on/off as needed
  40. Step 4 Add a bridging CSS file HTML file Bridging CSS file
  41. Question Why add a bridging file? • One link to all CSS files in HTML • Change CSS without changing HTML • Add or remove files as needed
  42. Step 5 Link to bridging file HTML file Bridging CSS file
  43. HTML file <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN” &quot;http://www.w3.org/TR/html4/strict.dtd&quot;> <html> <head> <title>Modular CSS</title> <link rel=&quot;stylesheet&quot; href=&quot;bridging.css&quot; type=&quot;text/css” media=&quot;screen, projection&quot;> </head> <body> …
  44. Question Why double media type? • The bridging file will use @import • NN4 crashes on @import • NN4 ignores multiple media types • NN4 will not see bridging file
  45. Netscape 4 No CSS for you! HTML file Bridging CSS file NN4
  46. Step 6 Import CSS HTML file Bridging CSS file
  47. @import &quot;container.css&quot;; @import &quot;header.css&quot;; @import &quot;content.css&quot;; @import &quot;footer.css&quot;; Bridging CSS file
  48. Question How do @imports work? • Imports all rules from one file into other • Exactly as if written in other file • Order and placement are important • Cannot be read by older browsers
  49. Old browsers No CSS for you either! HTML file Bridging CSS file NN4 IE4 IE3
  50. mac/ie5
  51. Step 7 - option a Hide rules from Mac/IE HTML file Bridging CSS file
  52. @import &quot;container.css&quot;; @import &quot;header.css&quot;; @import &quot;content.css&quot;; @import &quot;footer.css&quot;; @import 'hide-from-mac-ie5.css'; Bridging CSS file
  53. Question How does this work? • Place specific rules in a separate file • @import using single quotes • Mac/IE will ignore single quotes • Mac/IE will ignore chosen rules
  54. Step 7 - option b Hide all from Mac/IE HTML file Bridging CSS file
  55. @import ‘ container.css ’ ; @import ‘ header.css ’ ; @import ‘ content.css ’ ; @import ‘ footer.css ’ ; Bridging CSS file
  56. win/ie
  57. Hacking hacks can bite • hacks and later versions of browser • hacks sitting inside CSS files • hacks may become unnecessary
  58. A better solution Conditional comments? • No hacks scattered through CSS files • Can be turned on or off • Can deal with different versions of IE • Recommended by the IE team
  59. Step 8 Dealing with Win/IE HTML file Bridging CSS file new file
  60. HTML file <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN” &quot;http://www.w3.org/TR/html4/strict.dtd&quot;> <html> <head> <title>Modular CSS</title> <link rel=&quot;stylesheet&quot; href=&quot;bridging.css&quot; type=&quot;text/css” media=&quot;screen, projection&quot;> <!--[if IE]> <link rel=&quot;stylesheet&quot; href=&quot;win-ie5.css” type=&quot;text/css&quot; media=&quot;screen&quot;> <![endif]--> </head>
  61. HTML file <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN” &quot;http://www.w3.org/TR/html4/strict.dtd&quot;> <html> <head> <title>Modular CSS</title> <link rel=&quot;stylesheet&quot; href=&quot;bridging.css&quot; type=&quot;text/css” media=&quot;screen, projection&quot;> <!--[if IE 5]> <link rel=&quot;stylesheet&quot; href=&quot;win-ie5.css” type=&quot;text/css&quot; media=&quot;screen&quot;> <![endif]--> </head>
  62. HTML file <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN” &quot;http://www.w3.org/TR/html4/strict.dtd&quot;> <html> <head> <title>Modular CSS</title> <link rel=&quot;stylesheet&quot; href=&quot;bridging.css&quot; type=&quot;text/css” media=&quot;screen, projection&quot;> <!--[if IE 6]> <link rel=&quot;stylesheet&quot; href=&quot;win-ie5.css” type=&quot;text/css&quot; media=&quot;screen&quot;> <![endif]--> </head>
  63. but what about print?
  64. Step 9 - option a Simple print CSS HTML file Bridging CSS file Print CSS
  65. HTML file <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN” &quot;http://www.w3.org/TR/html4/strict.dtd&quot;> <html> <head> <title>Modular CSS</title> <link rel=&quot;stylesheet&quot; href=&quot;bridging.css&quot; type=&quot;text/css” media=&quot;screen, projection&quot;> <!--[if IE 6]><link rel=&quot;stylesheet&quot; href=&quot;win-ie5.css” type=&quot;text/css&quot; media=&quot;screen&quot;><![endif]--> <link rel=&quot;stylesheet&quot; href=”print.css&quot; type=&quot;text/css” media=”print&quot;> </head>
  66. /* print styles */ #container { } #header { } #header h1 { } #content { } #content h2 { } Print CSS file
  67. Step 9 - option b Advanced print CSS HTML file Bridging CSS file
  68. HTML file <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN” &quot;http://www.w3.org/TR/html4/strict.dtd&quot;> <html> <head> <title>Modular CSS</title> <link rel=&quot;stylesheet&quot; href=&quot;bridging.css&quot; type=&quot;text/css” media=&quot;screen, projection&quot;> <!--[if IE 6]><link rel=&quot;stylesheet&quot; href=&quot;win-ie5.css” type=&quot;text/css&quot; media=&quot;screen&quot;><![endif]--> <link rel=&quot;stylesheet&quot; href=”print.css&quot; type=&quot;text/css” media=”print&quot;> </head>
  69. @import ‘container.css’; @import ‘header.css’; @import ‘content.css’; @import ‘footer.css’; /* print styles */ #container { } #header { } #header h1 { } #content { } #content h2 { } Bridging CSS file
  70. a recap?
  71. 1. Build you HTML 2. Build your CSS 3. Separate the CSS 4. Add a bridging file 5. Link from HTML to bridging file 6. Import CSS into bridging file 7. Hide from Mac/IE as needed 8. Hide from Win/IE as needed 9. Add print CSS
  72. downsides
  73. No perfect solution • Still involves dancing around browsers • Uses conditional comments • May be overly complex for tiny sites
  74. upsides
  75. Good points • modular • flexible • maintainable • browser-specific • hack free (well… sorta…)
  76. questions or abuse?

+ Russ WeakleyRuss Weakley, 3 years ago

custom

25402 views, 125 favs, 69 embeds more stats

A clearly explained modular system that allows you more

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 25402
    • 21147 on SlideShare
    • 4255 from embeds
  • Comments 9
  • Favorites 125
  • Downloads 1267
Most viewed embeds
  • 2376 views on http://woork.blogspot.com
  • 427 views on http://www.cssnolanche.com.br
  • 296 views on http://www.dreamcss.com
  • 205 views on http://w3css.blogspot.com
  • 197 views on http://dreamcss.blogspot.com

more

All embeds
  • 2376 views on http://woork.blogspot.com
  • 427 views on http://www.cssnolanche.com.br
  • 296 views on http://www.dreamcss.com
  • 205 views on http://w3css.blogspot.com
  • 197 views on http://dreamcss.blogspot.com
  • 134 views on http://podlipensky.com
  • 122 views on http://www.getincss.ru
  • 89 views on http://www.15seg.com
  • 66 views on http://izcirtejs.blogspot.com
  • 28 views on http://webtutorials4u.com
  • 26 views on http://techvideos.humourbox.info
  • 25 views on http://blog.reflectiv.net
  • 24 views on http://www.w3css.blogspot.com
  • 24 views on http://raja.tistory.com
  • 22 views on http://izcirtejs.lv
  • 22 views on http://blog.oxynel.com
  • 21 views on http://www.bubblefish.be
  • 20 views on http://www.barbarosalp.com
  • 19 views on http://acidminds.com
  • 11 views on http://www.tableless.com.br
  • 8 views on http://static.slideshare.net
  • 8 views on http://sc-net.blogspot.com
  • 7 views on http://infomaster.nazwa.pl
  • 6 views on http://bubblefish.be
  • 5 views on http://feeds2.feedburner.com
  • 4 views on http://www.woork.blogspot.com
  • 4 views on http://feeds.feedburner.com
  • 4 views on http://www.netvibes.com
  • 3 views on http://www.hanrss.com
  • 3 views on http://www.whitepixel.pl
  • 3 views on http://drupal
  • 2 views on http://creatingsexystylesheets.com
  • 2 views on http://monw3c.blogbus.com
  • 2 views on http://e-blog-gr.blogspot.com
  • 2 views on http://wildfire.gigya.com
  • 2 views on http://static.slidesharecdn.com
  • 2 views on http://www.reflectiv.net
  • 2 views on http://www.filescon.com
  • 2 views on http://www.newsgator.com
  • 1 views on http://74.125.159.132
  • 1 views on http://web-team.net.ua
  • 1 views on http://labs.friendsinteraction.com
  • 1 views on http://74.125.77.132
  • 1 views on http://www.danielwang.cn
  • 1 views on http://74.125.93.132
  • 1 views on http://www.slidesbox.com
  • 1 views on http://hotelsunset.co.cc
  • 1 views on http://www.infinitytricks.blogspot.com
  • 1 views on http://en.av5.info
  • 1 views on https://www.galileo.edu
  • 1 views on http://hghltd.yandex.net
  • 1 views on http://www.microsofttranslator.com
  • 1 views on http://apprentieweb.blogspot.com
  • 1 views on http://1006-w08.wikispaces.com
  • 1 views on http://www.rapidshareeasy.com
  • 1 views on http://whitepixel.pl
  • 1 views on resource://brief-content
  • 1 views on http://lelya-s.blogspot.com
  • 1 views on chrome://feedbar
  • 1 views on http://www.neurosoftware.ro
  • 1 views on http://danielwang130.blogspot.com
  • 1 views on http://209.85.143.132
  • 1 views on http://203.208.37.132
  • 1 views on http://64.233.183.132
  • 1 views on http://favit.bg
  • 1 views on http://xss.yandex.net
  • 1 views on http://salcher.wikispaces.com
  • 1 views on http://74.125.39.132
  • 1 views on http://www.adii.co.za

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories