- From: Sebastian Redl <sebastian.redl@getdesigned.at>
- Date: Fri, 23 Jun 2006 10:04:12 +0200
- To: www-html@w3.org
Nickolas Nansen wrote: > Working with nested tables, div tags and other elements may cause > problems > when combining code and especially when there will be different levels of > nesting. It's not always easy to keep track of how many div's to end > at the > end of the local code and there is a potential risk of making problems > for > the framing code. Because of this I would like to know if there is or > could > be made an attribute used by programmers to keep track of the tags. The > easiest part would be to use the id/class attribute also at ending the > tag, > but I am not sure whether this would confuse some browsers. 1) Indent your code. Since whitespace is largely immaterial in HTML, and since your linebreaks are already whitespace, you can simply add indents to properly nest tags. This makes finding the matching tags very easy. It's a time-proven technique used for ages in programming languages. <div id="one"> <div id="two"> <div id="three"> </div> </div> </div> 2) Use a proper editor. Many programmer's text editors, for example jEdit, will highlight the start tag when the caret is in the end tag, and the end tag when the caret is in the start tag. For very large distances and the most important wrappers I sometimes use the comment approach, but mostly that's not necessary. Neither is a change to HTML's/XML's syntax to allow attributes in the end tags, especially when they serve no discernible purpose beyond readability. (A computer will not have problems matching up your tags.) Sebastian Redl
Received on Friday, 23 June 2006 08:03:23 UTC