Difference between revisions of "HTML Coding Standard"

From GLMWiki
Jump to: navigation, search
 
Line 3: Line 3:
  
 
== HTML Doctype ==
 
== HTML Doctype ==
<nowiki><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+
<nowiki><!DOCTYPE HTML></nowiki>
"http://www.w3.org/TR/html4/strict.dtd"></nowiki>
+
  
  
Line 13: Line 12:
 
Example:
 
Example:
 
<pre>
 
<pre>
  <p>This is my list:
+
  <p>This is my list:</p>
  <ul>
+
<ul>
  <li>Item1</li>
+
  <li>Item1</li>
  <li>Item2
+
  <li>Item2
    <ul>
+
  <ul>
    <li>Item2.1</li>
+
    <li>Item2.1</li>
    <li>Item2.2</li>
+
    <li>Item2.2</li>
    </ul>
+
  </ul>
  </li>
+
  </li>
  </ul>
+
</ul>
  It is a nice list</p>
+
  <p>It is a nice list</p>
 
</pre>
 
</pre>
  

Latest revision as of 10:52, 8 March 2013

All web documents are to be written as HTML 4.01 Strict[1]. This ensures less confusion and stricter coding.

HTML Doctype

<!DOCTYPE HTML>


Indenting and line breaks

  • One line for each HTML element.
  • One tab between every child/parent.

Example:

 <p>This is my list:</p>
 <ul>
  <li>Item1</li>
  <li>Item2
   <ul>
    <li>Item2.1</li>
    <li>Item2.2</li>
   </ul>
  </li>
 </ul>
 <p>It is a nice list</p>

Validation

The HTML code should validate, but this is most important during development to catch errors. The only real measurement of valid code is the browsers. If it works on all out target browsers ++ then a HTML validation warning is for the most part a bagatelle.