Brett's Blog
Edit     New

Tuesday, July 31, 2007

Tidying a CMS

Here are some of the advantages and disadvantages I see of various approaches a CMS might take when attempting to move styles off into separate files including a site-wide stylesheet (in order to provide clean XHTML 1.1+ and CSS code which has no formatting content for the sake of browser caching of reused stylesheets, accessibility (special browsers can ignore stylesheets if external), manipulation of style code (if semantic and separated, it is easier), borrowability of structural code (should have no style information inside), etc.)






SituationsDisadvantagesAdvantages
Incorporate site-wide stylesheetCould get to large with all authors' styles
Could lose semantics if automatically encapsulating inline styles
Potential conflict between various author-created classes and complexity of numbering and integrating their inline style classes
Best for caching, site-wide control, accessibility
Page-specific stylesheetToo many files would need saving (each author's)--but only need to process/save when editing)
Slower to make a PHP-generated CSS file called on each non-cached visit by a different user, though could also save and check for cached file if not user-specifiable style combo (e.g., if letting them type in any old CSS info with a decimal, RGB, etc.
accessibility
Style tag in headAll browsers must download the code even if they don't handle or want to handle styles (unless server could be made to detect content type request and remove the tag by XPath/XSLT/XQuery!)Allows indefinite # of combos when user-defined styles are added without requiring extra files for each and garbage collection nor is a script required
Inline style attributesDeprecated attribute
All browsers must download the code...
Difficulty in ignoring by humans and to a small degree by computers and can't be reused so may get large unless "style=''" smaller than "class='blah'" which is doubtful
Avoids duplication, need for unique id, etc.


Could consolidate via Tidy styles found from Inline -> head -> page-specific (including imported page-specific ones) with no disadvantages as far as semantics (would actually improve), but when going further to -> Site-wide, would be a problem in consolidating.

As a compromise, document submitter could offer independent or dependent stylesheet for potential reuse site-wide or across some files.


Google
 
Brett's Blog Web