[thelist] Coding standards....

Barney Carroll barney at textmatters.com
Thu Dec 7 10:14:37 CST 2006


Julian Rickards wrote:
> Comments may be more relevant in programming code (JS, PHP, etc.) rather
> than HTML but I wouldn't exclude comments from HTML.

With large and complex HTML element nesting I find comments on end tags 
are very useful. For example:

<body>
  <div id="wrapper">
   <div id="header">
   </div>
   <div id="innerwrapper">
    <div id="navigation">
    </div>
    <div id="content">
     <div id="copy">
     </div> <!-- id="copy" -->
    </div> <!-- id="content" -->
   </div> <!-- id="innerwrapper" -->
  </div> <!-- id="wrapper" -->
</body>

Comments for developers should always be kept in an external file - a 
wiki of some form is essential for large products with multiple authors. 
My attitude to markup, especially now that I'm ever-aware of standards, 
semantic markup and validation, is that you should treat HTML as if it's 
going to be read out by the user. Anything that would be inappropriate 
or unhelpful in this situation is pretty much inappropriate full stop 
for me.

> I would add to that "Valid (X)HTML" - validate before posting. But a step
> towards this would be creating valid and usable templates that others can
> use.

Of course... Always validate! That's one of those good practices I 
always somehow forget.

Another thing... If you at any point get serious with complex CSS that 
needs to be read and understood by a lot of people there is an 
application I find absolutely fantastic called StyleSpread 
[http://stylespread.com]. It's just reached version 1 and is a fantastic 
way of dealing with stylesheets in an intelligent, component-based 
manner rather than simply as huge text files.

Regards,
Barney



More information about the thelist mailing list