[documentation] Request: Drupal Stylesheet Guidelines

Gary Feldman dpal_gaf_doc at marsdome.com
Tue Jul 11 13:23:43 UTC 2006


Adrian Simmons wrote:
> Christian Berg wrote:
>> 2.) Modules should prefix their css classes to prevent collisions.
>>     for example: <div class="foo_listheader"></div>
> This suggestion keeps coming up, particularly from the programmer type 
> people, but it's really just unnecessary bloat. For most modules 
> simply wrapping module output in a container with class="modulename" 
> will suffice.
Frequently, even the wrapper is unnecessary, depending upon what the 
output is.  If the natural form of the output is already a single XHTML 
element, then just add the module name to the class for that element.  
This is obvious when the module is already generating a <div>, but I 
could conceive of a module just generating an <ul> (for example), in 
which case <ul class="module-name">... works without needing a <div> 
wrapper.
> 4.)  If Drupal gets an identing rule, we also should apply this for CSS.
> Er...what? Use the same ID's thoughout? It'ss already used, but worth 
> documenting.
I thought this was just a typo, and meant "indenting."  Either way, it's 
worth documenting.
> > 5.)  Naming Convention: Strictly lowercase, words seperated with _
> There is already a convention of lower case words with - as a seperator.
Naming convention for ids?  Classes?  Both? 

The case convention gets to be interesting because there's already such 
a variety in module names.  Perhaps consistency with module names isn't 
a necessary goal, but my preference would be to preserve case at least 
for those modules using CamelCase.  I'm also not sure if there needs to 
be a convention to distinguish between classes defined by modules and 
those defined by themes, or between classes and ids.  (I'm constantly 
using . when I should use #.)

Gary



More information about the documentation mailing list