[development] 4.8/5.0: Modules, namespaces. CSS

Darrel O'Pry dopry at thing.net
Fri Feb 24 18:32:30 UTC 2006


On Thu, 2006-02-23 at 15:34 +0000, Adrian Simmons wrote:
> Adrian Rossouw wrote:
> > So that all css classes / id's created by drupal get prefixed by the 
> > name of the module they are generated by.
> This just seems to be an extension of the id-itus and class-itus that 
> already afflicts Drupal. Most modules output their content in a container 
> (usually a div, occasionally a table), all that's required is to have that 
> container tagged with and id or class representative of the module.
> 
> Then use the CSS cascade properly to style any child elements.
> 
> Slapping a prefix on everything is just bloat - why is it that bloat in PHP 
> files is bad but bloat in XHTML and CSS is acceptable?

Bloat in php files is code that must be read, compiled, and executed...
not simply read and fed. Good naming conventions are encouraged
throughout drupal. Verbose naming of ID's and Classes assist developers
and designers working together, and provide more semantics to the markup
for search engines to take advantage of.
 
I personally prefer only using ID for a know content item. block or
node. Then using multiple classes..

id='node-29' class='node node-page'
class='.help .aggregator-help'




> > you can
> > immediately see which file the css is defined in, and which file you 
> > need to override.
> It's really not that much harder to find a parent div/table and check out 
> it's class/id.

but finding the file in which it is defined can be difficult, and for a
developer communicating with a designer who isn't drupal-saavy, verbose
class names can ease the designer developer communication.




More information about the development mailing list